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