annotate bug-list.xsl @ 0:8cae44c166d3

initial xslt and sample xml
author cin
date Thu, 20 Aug 2015 20:54:19 +0300
parents
children d1400de5832b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
1 <?xml version="1.0" encoding="UTF-8"?>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
2 <xsl:stylesheet version="1.0"
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
4 <xsl:output method="text" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
5 <xsl:key name="bugs-key" match="bug" use="bug_id" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
6 <xsl:variable name="roots" select="bugzilla/bug[not(blocked[key('bugs-key',.)])]"/>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
7
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
8 <xsl:template match="/">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
9 <xsl:apply-templates select="$roots"/>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
10 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
11
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
12 <xsl:template match="bug">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
13 <xsl:call-template name="bug-template" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
14 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
15
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
16 <xsl:template match="text()" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
17
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
18 <xsl:template name="bug-template">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
19 <xsl:param name="indent" select="0" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
20 <xsl:variable name="isOrganizing" select="component = 'product'"></xsl:variable>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
21
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
22 <xsl:call-template name="start-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
23 <xsl:with-param name="indent" select="$indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
24 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
25
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
26 <xsl:if test="$isOrganizing">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
27
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
28 </xsl:if>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
29
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
30 <xsl:choose>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
31 <xsl:when test="$isOrganizing">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
32 <xsl:for-each select="dependson">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
33 <xsl:for-each select="key('bugs-key', .)">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
34 <xsl:call-template name="bug-template">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
35 <xsl:with-param name="indent" select="$indent + 1" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
36 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
37 </xsl:for-each>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
38 </xsl:for-each>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
39 </xsl:when>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
40 <xsl:otherwise>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
41 <xsl:if test="number(estimated_time)">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
42 <xsl:call-template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
43 <xsl:with-param name="indent" select="$indent + 1" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
44 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
45 <xsl:value-of select="concat('effort ', estimated_time, 'h')" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
46 <xsl:call-template name="end-line" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
47 </xsl:if>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
48 </xsl:otherwise>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
49 </xsl:choose>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
50
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
51 <xsl:call-template name="end-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
52 <xsl:with-param name="indent" select="$indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
53 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
54 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
55
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
56 <xsl:template name="make-bug-id">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
57 <xsl:param name="id"></xsl:param>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
58 <xsl:value-of select="concat('bug', $id)"></xsl:value-of>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
59 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
60
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
61 <xsl:template name="start-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
62 <xsl:param name="indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
63 <xsl:call-template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
64 <xsl:with-param name="indent" select="$indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
65 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
66 <xsl:text>task </xsl:text>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
67 <xsl:call-template name="make-bug-id">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
68 <xsl:with-param name="id" select="bug_id" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
69 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
70 <xsl:value-of select="concat(' &quot;',short_desc,'&quot; {')" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
71 <xsl:call-template name="end-line" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
72 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
73
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
74 <xsl:template name="end-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
75 <xsl:param name="indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
76 <xsl:call-template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
77 <xsl:with-param name="indent" select="$indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
78 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
79 <xsl:text>}</xsl:text>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
80 <xsl:call-template name="end-line" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
81 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
82
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
83 <xsl:template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
84 <xsl:param name="indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
85 <xsl:if test="number($indent) > 0">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
86 <xsl:text> </xsl:text>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
87 <xsl:call-template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
88 <xsl:with-param name="indent" select="$indent - 1" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
89 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
90 </xsl:if>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
91 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
92 <xsl:template name="end-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
93 <xsl:text>&#xa;</xsl:text>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
94 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
95 </xsl:stylesheet>