annotate bug-list.xsl @ 4:f8f966388b68

xslt: bugzilla -> taskjuggler
author cin
date Mon, 24 Aug 2015 20:50:23 +0300
parents 36ae3ec94442
children d2efec56373f
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"
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
4 extension-element-prefixes="exsl">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
5 <xsl:output method="text" indent="yes" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
6
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
7 <xsl:variable name="resources"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
8 select="document('resources.xml')/resources/resource" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
9
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
10 <xsl:variable name="bugs" select="/bugzilla/bug" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
11
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
12 <xsl:key name="bugid" match="/bugzilla/bug" use="string(bug_id)" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
13
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
14 <xsl:variable name="roots" select="$bugs[not(blocked[key('bugid',.)])]" />
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
15
d1400de5832b improved xsl
cin
parents: 0
diff changeset
16 <!-- BUILD BUG TREE -->
d1400de5832b improved xsl
cin
parents: 0
diff changeset
17 <xsl:variable name="tree">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
18 <xsl:apply-templates mode="tree" select="$roots" />
d1400de5832b improved xsl
cin
parents: 0
diff changeset
19 </xsl:variable>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
20
d1400de5832b improved xsl
cin
parents: 0
diff changeset
21 <xsl:template match="bug" mode="tree">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
22 <xsl:element name="bug">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
23 <xsl:attribute name="id"><xsl:value-of select="bug_id" /></xsl:attribute>
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
24 <xsl:if test="component = 'product' or not(number(estimated_time))">
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
25 <xsl:attribute name="product"><xsl:value-of select="boolean(1)" /></xsl:attribute>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
26 </xsl:if>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
27 <xsl:for-each select="dependson">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
28 <xsl:apply-templates mode="tree" select="key('bugid', .)" />
d1400de5832b improved xsl
cin
parents: 0
diff changeset
29 </xsl:for-each>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
30 </xsl:element>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
31 </xsl:template>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
32
d1400de5832b improved xsl
cin
parents: 0
diff changeset
33 <!-- CALCULATE RELATIONS -->
d1400de5832b improved xsl
cin
parents: 0
diff changeset
34 <xsl:variable name="relations">
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
35 <xsl:apply-templates select="$bugs" mode="relations" />
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
36 </xsl:variable>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
37
d1400de5832b improved xsl
cin
parents: 0
diff changeset
38 <xsl:template match="bug" mode="relations">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
39 <xsl:variable name="bugid" select="string(bug_id)" />
d1400de5832b improved xsl
cin
parents: 0
diff changeset
40 <bug id="{$bugid}">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
41 <xsl:apply-templates select="exsl:node-set($tree)//bug[@id = $bugid]"
d1400de5832b improved xsl
cin
parents: 0
diff changeset
42 mode="traverse-relations">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
43 </xsl:apply-templates>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
44 </bug>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
45 </xsl:template>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
46
d1400de5832b improved xsl
cin
parents: 0
diff changeset
47 <xsl:template match="bug" mode="traverse-relations">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
48 <xsl:variable name="bugid" select="@id" />
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
49 <xsl:variable name="path" select="ancestor::bug" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
50 <xsl:variable name="level" select="count($path)" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
51 <xsl:for-each select="$path[@product]">
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
52 <xsl:variable name="pos" select="position()" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
53 <xsl:variable name="rank" select="$level - $pos" />
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
54 <rel container="{@id}" rank="{$rank}" level="{$level}">
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
55 <xsl:for-each select="$path[position() >= $pos and @product]">
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
56 <bug id="{@id}" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
57 </xsl:for-each>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
58 </rel>
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
59 </xsl:for-each>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
60 </xsl:template>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
61
d1400de5832b improved xsl
cin
parents: 0
diff changeset
62 <!-- CALCULATE STRUCTURE -->
d1400de5832b improved xsl
cin
parents: 0
diff changeset
63
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
64 <xsl:variable name="parents">
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
65 <xsl:apply-templates select="exsl:node-set($relations)"
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
66 mode="parents" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
67 </xsl:variable>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
68
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
69 <xsl:template match="bug" mode="parents">
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
70 <xsl:variable name="parent"
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
71 select="rel[ not(../rel/@rank &lt; @rank) ][1]" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
72 <bug id="{@id}" parent="{$parent/@container}" rank="{$parent/@rank}"
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
73 level="{$parent/@level}" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
74 </xsl:template>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
75
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
76 <xsl:variable name="structure">
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
77 <xsl:apply-templates select="$roots" mode="structure" />
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
78 </xsl:variable>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
79
d1400de5832b improved xsl
cin
parents: 0
diff changeset
80 <xsl:template match="bug" mode="structure">
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
81 <xsl:variable name="id" select="string(bug_id)" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
82 <xsl:variable name="self" select="." />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
83 <bug id="{$id}">
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
84 <xsl:for-each select="exsl:node-set($parents)/bug[@parent = $id]">
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
85 <xsl:variable name="child" select="@id" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
86 <xsl:apply-templates select="$bugs[bug_id = $child]"
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
87 mode="structure" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
88 </xsl:for-each>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
89 <xsl:variable name="dependencies"
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
90 select="dependson[not(text() = exsl:node-set($parents)/bug[@parent = $id]/@id)]" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
91 <xsl:if test="$dependencies">
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
92 <depends>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
93 <xsl:for-each select="$dependencies">
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
94 <bug id="{.}" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
95 </xsl:for-each>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
96 </depends>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
97 </xsl:if>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
98 </bug>
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
99 </xsl:template>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
100
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
101 <!-- output -->
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
102 <xsl:template match="/">
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
103 <xsl:apply-templates select="exsl:node-set($structure)/bug">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
104 <xsl:with-param name="indent" select="0" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
105 </xsl:apply-templates>
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
106 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
107
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
108 <xsl:template match="bug">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
109 <xsl:param name="indent" select="0" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
110 <xsl:variable name="id" select="@id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
111 <xsl:variable name="details" select="$bugs[bug_id = $id]" />
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
112 <xsl:call-template name="start-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
113 <xsl:with-param name="indent" select="$indent" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
114 <xsl:with-param name="id" select="@id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
115 <xsl:with-param name="desc" select="$details/short_desc" />
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
116 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
117
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
118 <xsl:for-each select="$details/*">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
119 <xsl:variable name="directive">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
120 <xsl:apply-templates select="." mode="task-details" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
121 </xsl:variable>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
122 <xsl:if test="string($directive)">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
123 <xsl:call-template name="begin-line">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
124 <xsl:with-param name="indent" select="$indent + 1" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
125 </xsl:call-template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
126 <xsl:value-of select="$directive" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
127 <xsl:call-template name="end-line" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
128 </xsl:if>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
129 </xsl:for-each>
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
130
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
131 <xsl:apply-templates>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
132 <xsl:with-param name="indent" select="$indent + 1" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
133 </xsl:apply-templates>
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
134
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
135 <xsl:call-template name="end-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
136 <xsl:with-param name="indent" select="$indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
137 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
138 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
139
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
140 <xsl:template match="estimated_time" mode="task-details">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
141 <xsl:if test="number(.)">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
142 <xsl:value-of select="concat('effort ', .,'h')" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
143 </xsl:if>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
144 </xsl:template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
145
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
146 <xsl:template match="assigned_to" mode="task-details">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
147 <xsl:variable name="email" select="string(.)" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
148 <xsl:variable name="resource" select="$resources[@email = $email]/@id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
149 <xsl:if test="$resource">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
150 <xsl:value-of select="concat('allocate ', $resource)" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
151 </xsl:if>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
152 </xsl:template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
153 <xsl:template match="text()" mode="task-details">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
154 </xsl:template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
155
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
156 <xsl:template match="depends">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
157 <xsl:param name="indent" select="0" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
158 <xsl:call-template name="begin-line">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
159 <xsl:with-param name="indent" select="$indent" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
160 </xsl:call-template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
161 <xsl:text>depends </xsl:text>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
162 <xsl:apply-templates>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
163 <xsl:with-param name="referer" select=".." />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
164 </xsl:apply-templates>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
165 <xsl:call-template name="end-line" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
166 </xsl:template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
167
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
168 <xsl:template match="depends/bug">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
169 <xsl:param name="referer" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
170 <xsl:call-template name="bug-reference">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
171 <xsl:with-param name="id" select="@id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
172 <xsl:with-param name="referer" select="$referer" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
173 </xsl:call-template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
174 <xsl:if test="position() != last()">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
175 <xsl:text>, </xsl:text>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
176 </xsl:if>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
177 </xsl:template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
178
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
179
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
180 <xsl:template match="text()" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
181
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
182
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
183
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
184 <xsl:template name="bug-local-name">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
185 <xsl:param name="id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
186 <xsl:value-of select="concat('bug',$id)" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
187 </xsl:template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
188
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
189
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
190 <xsl:template name="bug-reference">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
191 <xsl:param name="id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
192 <xsl:param name="referer" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
193
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
194 <xsl:variable name="refererPathFragment">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
195 <bug id="#root" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
196 <xsl:for-each select="$referer/ancestor-or-self::bug">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
197 <bug id="{@id}" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
198 </xsl:for-each>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
199 </xsl:variable>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
200 <xsl:variable name="targetPathFragment">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
201 <bug id="#root" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
202 <xsl:for-each
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
203 select="exsl:node-set($structure)//bug[local-name(..) != 'depends' and @id = $id]/ancestor-or-self::bug">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
204 <bug id="{@id}" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
205 </xsl:for-each>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
206 </xsl:variable>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
207 <xsl:variable name="path"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
208 select="exsl:node-set($refererPathFragment)/bug" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
209 <xsl:variable name="targetPath"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
210 select="exsl:node-set($targetPathFragment)/bug" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
211
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
212 <!-- find closest shared container id -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
213 <xsl:variable name="join"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
214 select="($path[@id = $targetPath/@id])[position() = last() ]/@id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
215
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
216 <!-- how many levels we need to up -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
217 <xsl:variable name="depth"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
218 select="count($path[@id = $join]/following-sibling::node())" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
219
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
220 <!-- DEBUG -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
221 <!-- <xsl:value-of select="concat('id=', $id, ',referer=', $referer/@id)"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
222 /> <xsl:text>, path=</xsl:text> <xsl:for-each select="$targetPath"> <xsl:value-of
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
223 select="concat(name(),@id)" /> <xsl:if test="position() != last()"> <xsl:text>-</xsl:text>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
224 </xsl:if> </xsl:for-each> -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
225 <!-- DEBUG -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
226 <!-- <xsl:value-of select="concat(', join=', $join,', depth=', $depth,'
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
227 ')" /> -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
228
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
229 <!-- PRINT REFERENCE -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
230 <xsl:call-template name="repeat">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
231 <xsl:with-param name="value" select="'!'" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
232 <xsl:with-param name="count" select="$depth" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
233 </xsl:call-template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
234 <xsl:for-each select="$targetPath[@id = $join]/following-sibling::node()">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
235 <xsl:call-template name="bug-local-name">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
236 <xsl:with-param name="id" select="@id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
237 </xsl:call-template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
238 <xsl:if test="position() != last()">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
239 <xsl:text>.</xsl:text>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
240 </xsl:if>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
241 </xsl:for-each>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
242
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
243 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
244
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
245 <xsl:template name="start-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
246 <xsl:param name="indent" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
247 <xsl:param name="id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
248 <xsl:param name="desc" />
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
249 <xsl:call-template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
250 <xsl:with-param name="indent" select="$indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
251 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
252 <xsl:text>task </xsl:text>
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
253 <xsl:call-template name="bug-local-name">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
254 <xsl:with-param name="id" select="$id" />
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
255 </xsl:call-template>
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
256 <xsl:value-of select="concat(' &quot;',$desc,'&quot; {')" />
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
257 <xsl:call-template name="end-line" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
258 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
259
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
260 <xsl:template name="end-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
261 <xsl:param name="indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
262 <xsl:call-template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
263 <xsl:with-param name="indent" select="$indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
264 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
265 <xsl:text>}</xsl:text>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
266 <xsl:call-template name="end-line" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
267 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
268
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
269 <xsl:template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
270 <xsl:param name="indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
271 <xsl:if test="number($indent) > 0">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
272 <xsl:text> </xsl:text>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
273 <xsl:call-template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
274 <xsl:with-param name="indent" select="$indent - 1" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
275 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
276 </xsl:if>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
277 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
278 <xsl:template name="end-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
279 <xsl:text>&#xa;</xsl:text>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
280 </xsl:template>
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
281
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
282 <xsl:template name="repeat">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
283 <xsl:param name="value" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
284 <xsl:param name="count" select="0" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
285
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
286 <xsl:if test="number($count)">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
287 <xsl:copy-of select="$value" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
288 <xsl:call-template name="repeat">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
289 <xsl:with-param name="value" select="$value" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
290 <xsl:with-param name="count" select="$count - 1" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
291 </xsl:call-template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
292 </xsl:if>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
293 </xsl:template>
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
294 </xsl:stylesheet>