annotate bug-list.xsl @ 11:4eb9fdf4efa9

refactoring, non-working bookings
author cin
date Mon, 07 Sep 2015 19:18:21 +0300
parents 14a966369278
children 52b34ea50eff
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"
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
4 xmlns:date="http://exslt.org/dates-and-times"
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
5 extension-element-prefixes="exsl date">
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
6 <xsl:output method="text" indent="yes" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
7
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
8 <!-- PARAMETERS -->
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
9
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
10 <!-- chargeset - название аккаунта, на который вести расходы -->
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
11 <xsl:param name="chargeset" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
12
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
13 <!-- root_task_id - id корневой задачи, в которую будут организованы все
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
14 задачи -->
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
15 <xsl:param name="root_task_id" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
16
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
17 <!-- root_task - описание корневой задачи -->
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
18 <xsl:param name="root_task" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
19
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
20 <!-- GLOBAL VARIABLES -->
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
21 <xsl:variable name="resources"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
22 select="document('resources.xml')/resources/resource" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
23
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
24 <xsl:variable name="bugs" select="/bugzilla/bug" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
25
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 6
diff changeset
26 <xsl:key name="bugid" match="/bugzilla/bug" use="string(id)" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
27
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 6
diff changeset
28 <xsl:variable name="roots" select="$bugs[not(blocks[key('bugid',.)])]" />
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
29
d1400de5832b improved xsl
cin
parents: 0
diff changeset
30 <!-- BUILD BUG TREE -->
d1400de5832b improved xsl
cin
parents: 0
diff changeset
31 <xsl:variable name="tree">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
32 <xsl:apply-templates mode="tree" select="$roots" />
d1400de5832b improved xsl
cin
parents: 0
diff changeset
33 </xsl:variable>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
34
d1400de5832b improved xsl
cin
parents: 0
diff changeset
35 <xsl:template match="bug" mode="tree">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
36 <xsl:element name="bug">
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 6
diff changeset
37 <xsl:attribute name="id"><xsl:value-of select="id" /></xsl:attribute>
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
38 <xsl:if test="component = 'product' or not(number(estimated_time))">
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
39 <xsl:attribute name="group"><xsl:value-of select="boolean(1)" /></xsl:attribute>
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
40 </xsl:if>
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 6
diff changeset
41 <xsl:for-each select="depends_on">
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
42 <xsl:apply-templates mode="tree" select="key('bugid', .)" />
d1400de5832b improved xsl
cin
parents: 0
diff changeset
43 </xsl:for-each>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
44 </xsl:element>
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 <!-- CALCULATE RELATIONS -->
d1400de5832b improved xsl
cin
parents: 0
diff changeset
48 <xsl:variable name="relations">
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
49 <xsl:apply-templates select="$bugs" mode="relations" />
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
50 </xsl:variable>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
51
d1400de5832b improved xsl
cin
parents: 0
diff changeset
52 <xsl:template match="bug" mode="relations">
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 6
diff changeset
53 <xsl:variable name="bugid" select="string(id)" />
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
54 <bug id="{$bugid}">
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
55 <!-- calculate all palaces where the same node appears -->
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
56 <xsl:apply-templates select="exsl:node-set($tree)//bug[@id = $bugid]"
d1400de5832b improved xsl
cin
parents: 0
diff changeset
57 mode="traverse-relations">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
58 </xsl:apply-templates>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
59 </bug>
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 <xsl:template match="bug" mode="traverse-relations">
d1400de5832b improved xsl
cin
parents: 0
diff changeset
63 <xsl:variable name="bugid" select="@id" />
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
64 <xsl:variable name="path" select="ancestor::bug" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
65 <xsl:variable name="level" select="count($path)" />
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
66 <!-- for the specified path calculate the distances to the preceding container -->
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
67 <xsl:for-each select="$path[@group]">
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
68 <xsl:variable name="pos" select="position()" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
69 <xsl:variable name="rank" select="$level - $pos" />
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
70 <rel container="{@id}" rank="{$rank}" level="{$level}">
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
71 <!-- record the full path -->
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
72 <xsl:for-each select="$path[@group]">
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
73 <parent id="{@id}" bugid="{$bugid}" />
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
74 </xsl:for-each>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
75 </rel>
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
76 </xsl:for-each>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
77 </xsl:template>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
78
d1400de5832b improved xsl
cin
parents: 0
diff changeset
79 <!-- CALCULATE STRUCTURE -->
d1400de5832b improved xsl
cin
parents: 0
diff changeset
80
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
81 <xsl:variable name="parents">
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
82 <xsl:apply-templates select="exsl:node-set($relations)"
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
83 mode="parents" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
84 </xsl:variable>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
85
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
86 <xsl:template match="bug" mode="parents">
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
87 <xsl:variable name="parent"
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
88 select="rel[ not(../rel/@rank &lt; @rank) ][1]" />
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
89 <bug id="{@id}" parent="{$parent/@container}" rank="{$parent/@rank}"
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
90 level="{$parent/@level}">
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
91 <xsl:copy-of select="$parent/node()" />
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
92 </bug>
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
93 </xsl:template>
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
94
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
95 <xsl:variable name="structure">
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
96 <xsl:choose>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
97 <xsl:when test="$root_task">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
98 <bug id="_root" desc="{$root_task}" group="true">
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
99 <xsl:apply-templates select="$roots" mode="structure" />
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
100 </bug>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
101 </xsl:when>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
102 <xsl:otherwise>
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
103 <xsl:apply-templates select="$roots" mode="structure" />
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
104 </xsl:otherwise>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
105 </xsl:choose>
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
106 </xsl:variable>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
107
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
108 <!-- applied in context of the bugzilla document -->
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
109 <xsl:template match="bug" mode="structure">
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 6
diff changeset
110 <xsl:variable name="id" select="string(id)" />
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
111 <xsl:variable name="self" select="." />
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
112 <xsl:variable name="children"
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
113 select="exsl:node-set($parents)/bug[@parent = $id]" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
114 <xsl:element name="bug">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
115 <xsl:attribute name="id"><xsl:value-of select="$id" /></xsl:attribute>
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 6
diff changeset
116 <xsl:attribute name="desc"><xsl:value-of select="summary" /></xsl:attribute>
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
117 <xsl:attribute name="estimated"><xsl:value-of
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
118 select="number((time/estimated | estimated_time)[1])" /></xsl:attribute>
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
119
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
120 <xsl:if test="$children">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
121 <xsl:attribute name="group"><xsl:value-of select="boolean($children)" /></xsl:attribute>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
122
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
123 <xsl:for-each select="$children">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
124 <xsl:variable name="child" select="@id" />
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 6
diff changeset
125 <xsl:apply-templates select="$bugs[id = $child]"
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
126 mode="structure" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
127 </xsl:for-each>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
128
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
129 </xsl:if>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
130
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
131 <!-- filter out dependencies -->
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
132 <!-- exclude children, and missing bugs -->
3
36ae3ec94442 xslt: prepare taskjuggler tasks structure
cin
parents: 1
diff changeset
133 <xsl:variable name="dependencies"
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 6
diff changeset
134 select="depends_on[not(text() = exsl:node-set($parents)/bug/parent[@id=$id]/@bugid)][key('bugid', .)]" />
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
135 <xsl:for-each select="$dependencies">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
136 <dependency id="{.}" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
137 </xsl:for-each>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
138 </xsl:element>
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
139 </xsl:template>
d1400de5832b improved xsl
cin
parents: 0
diff changeset
140
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
141 <!-- output -->
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
142 <xsl:template match="/">
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
143 <xsl:apply-templates select="exsl:node-set($structure)/bug">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
144 <xsl:with-param name="indent" select="0" />
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
145 <xsl:with-param name="chargeset" select="$chargeset" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
146 </xsl:apply-templates>
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
147 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
148
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
149 <!-- task -->
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
150 <xsl:template match="bug">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
151 <xsl:param name="indent" select="0" />
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
152 <xsl:param name="chargeset" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
153
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
154 <!-- format the task header -->
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
155 <xsl:call-template name="start-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
156 <xsl:with-param name="indent" select="$indent" />
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
157 <xsl:with-param name="id">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
158 <xsl:call-template name="bug-local-name">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
159 <xsl:with-param name="id" select="@id" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
160 </xsl:call-template>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
161 </xsl:with-param>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
162 <xsl:with-param name="desc" select="@desc" />
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
163 </xsl:call-template>
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
164
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
165 <!-- specify chargeset if present -->
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
166 <xsl:if test="$chargeset">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
167 <xsl:call-template name="println">
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
168 <xsl:with-param name="indent" select="$indent + 1" />
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
169 <xsl:with-param name="text"
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
170 select="concat('chargeset ', $chargeset)" />
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
171 </xsl:call-template>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
172 </xsl:if>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
173
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
174 <!-- print task contents -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
175 <xsl:apply-templates select="." mode="task-content">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
176 <xsl:with-param name="indent" select="$indent + 1" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
177 </xsl:apply-templates>
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
178
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
179 <!-- prints subtasks and dependencies -->
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
180 <xsl:apply-templates>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
181 <xsl:with-param name="indent" select="$indent + 1" />
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
182 <xsl:with-param name="referer" select="." />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
183 </xsl:apply-templates>
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
184
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
185 <xsl:call-template name="end-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
186 <xsl:with-param name="indent" select="$indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
187 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
188 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
189
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
190 <!-- dependency -->
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
191 <xsl:template match="dependency">
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
192 <xsl:param name="indent" select="0" />
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
193 <xsl:param name="referer" />
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
194
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
195 <xsl:call-template name="println">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
196 <xsl:with-param name="indent" select="$indent" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
197 <xsl:with-param name="text">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
198 <xsl:text>depends </xsl:text>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
199 <xsl:call-template name="bug-reference">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
200 <xsl:with-param name="id" select="@id" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
201 <xsl:with-param name="referer" select="$referer" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
202 </xsl:call-template>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
203 </xsl:with-param>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
204 </xsl:call-template>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
205 </xsl:template>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
206
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
207 <!-- an organizational task with spent/estimated time will contain a generated
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
208 task which will contain the information about resource allocation and bookings -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
209 <xsl:template match="bug[@group][@estimated > 0]" mode="task-content"
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
210 priority="3">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
211 <xsl:param name="indent" select="0" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
212 <xsl:variable name="id" select="@id" />
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
213
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
214 <!-- DEBUG -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
215 <xsl:call-template name="comment">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
216 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
217 <xsl:with-param name="comment" select="'group'" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
218 </xsl:call-template>
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
219
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
220 <!-- print group details -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
221 <xsl:apply-templates select="$bugs[id = $id]/node()"
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
222 mode="group-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
223 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
224 </xsl:apply-templates>
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
225
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
226 <xsl:variable name="metabug">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
227 <bug id="{@id}" estimated="{@estimated}" desc="{@desc}" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
228 </xsl:variable>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
229
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
230 <!-- write an administrative bug for this group-task -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
231 <xsl:apply-templates select="exsl:node-set($metabug)/bug[1]">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
232 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
233 </xsl:apply-templates>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
234 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
235
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
236 <!-- an organizational task without resource allocations -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
237 <xsl:template match="bug[@group]" mode="task-content">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
238 <xsl:param name="indent" select="0" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
239 <xsl:variable name="id" select="@id" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
240 <xsl:apply-templates select="$bugs[id = $id]/node()"
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
241 mode="group-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
242 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
243 </xsl:apply-templates>
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
244 </xsl:template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
245
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
246 <!-- a work task -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
247 <xsl:template match="bug[@estimated > 0]" mode="task-content">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
248 <xsl:param name="indent" select="0" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
249 <xsl:variable name="id" select="@id" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
250
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
251 <!-- DEBUG -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
252 <xsl:call-template name="comment">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
253 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
254 <xsl:with-param name="comment" select="'work'" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
255 </xsl:call-template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
256
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
257 <xsl:apply-templates select="$bugs[id = $id]/node()"
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
258 mode="work-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
259 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
260 </xsl:apply-templates>
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
261 </xsl:template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
262
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
263 <!-- a milestone task -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
264 <xsl:template match="bug" mode="task-content">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
265 <xsl:param name="indent" select="0" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
266 <xsl:variable name="id" select="@id" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
267
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
268 <!-- DEBUG -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
269 <xsl:call-template name="comment">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
270 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
271 <xsl:with-param name="comment" select="'milestone'" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
272 </xsl:call-template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
273
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
274 <xsl:apply-templates select="$bugs[id = $id]/node()"
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
275 mode="milestone-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
276 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
277 </xsl:apply-templates>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
278 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
279
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
280 <!-- each type of task processed in the corresponding mode MODES: * group-task
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
281 * work-task * milestone-task -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
282
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
283 <!-- group-task -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
284 <xsl:template match="assigned_to" mode="group-task">
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
285 <xsl:param name="indent" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
286 <xsl:variable name="email" select="string(.)" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
287 <xsl:variable name="resource" select="$resources[@email = $email]/@id" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
288 <xsl:if test="$resource">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
289 <xsl:call-template name="println">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
290 <xsl:with-param name="indent" select="$indent" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
291 <xsl:with-param name="text"
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
292 select="concat('responsible ', $resource)" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
293 </xsl:call-template>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
294 </xsl:if>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
295 </xsl:template>
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
296
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
297 <xsl:template match="*" mode="group-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
298 <xsl:param name="indent" select="0" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
299 <xsl:apply-templates mode="group-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
300 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
301 </xsl:apply-templates>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
302 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
303
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
304 <xsl:template match="text()" mode="group-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
305 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
306
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
307
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
308 <!-- work-task -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
309 <xsl:template match="assigned_to" mode="work-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
310 <xsl:param name="indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
311 <xsl:variable name="email" select="string(.)" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
312 <xsl:variable name="resource" select="$resources[@email = $email]/@id" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
313 <xsl:if test="$resource">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
314 <xsl:call-template name="println">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
315 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
316 <xsl:with-param name="text" select="concat('allocate ', $resource)" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
317 </xsl:call-template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
318 </xsl:if>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
319 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
320
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
321 <!-- if we have a timereports -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
322 <xsl:template match="time/estimated[. > 0]" mode="work-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
323 <xsl:param name="indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
324 <xsl:call-template name="println">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
325 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
326 <xsl:with-param name="text" select="concat('effort ', .,'h')" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
327 </xsl:call-template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
328 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
329
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
330 <!-- if we have an estimated_time -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
331 <xsl:template match="estimated_time[../time/estimated = 0]"
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
332 mode="work-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
333 <xsl:param name="indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
334 <xsl:call-template name="comment">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
335 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
336 <xsl:with-param name="comment" select="'original estimated'" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
337 </xsl:call-template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
338 <xsl:call-template name="println">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
339 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
340 <xsl:with-param name="text" select="concat('effort ', .,'h')" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
341 </xsl:call-template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
342 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
343
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
344 <!-- time reports -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
345 <xsl:template match="time/report" mode="work-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
346 <xsl:param name="indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
347 <xsl:variable name="email" select="string(who)" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
348 <xsl:variable name="start" select="start" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
349 <xsl:variable name="work_time" select="work_time" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
350 <xsl:variable name="resource" select="$resources[@email = $email]/@id" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
351 <xsl:call-template name="println">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
352 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
353 <xsl:with-param name="text"
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
354 select="concat('booking ', $resource, ' ', $start, ' +', $work_time,'h { overtime 2 }')" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
355 </xsl:call-template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
356 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
357
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
358 <xsl:template match="*" mode="work-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
359 <xsl:param name="indent" select="0" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
360 <xsl:apply-templates mode="work-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
361 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
362 </xsl:apply-templates>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
363 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
364
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
365 <xsl:template match="text()" mode="work-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
366 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
367
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
368 <!-- milestone-task -->
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
369 <xsl:template match="assigned_to" mode="milestone-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
370 <xsl:param name="indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
371 <xsl:variable name="email" select="string(.)" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
372 <xsl:variable name="resource" select="$resources[@email = $email]/@id" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
373 <xsl:if test="$resource">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
374 <xsl:call-template name="println">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
375 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
376 <xsl:with-param name="text"
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
377 select="concat('responsible ', $resource)" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
378 </xsl:call-template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
379 </xsl:if>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
380 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
381
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
382 <xsl:template match="*" mode="milestone-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
383 <xsl:param name="indent" select="0" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
384 <xsl:apply-templates mode="milestone-task">
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
385 <xsl:with-param name="indent" select="$indent" />
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
386 </xsl:apply-templates>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
387 </xsl:template>
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
388
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
389 <xsl:template match="text()" mode="milestone-task">
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
390 </xsl:template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
391
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
392 <!-- PRIMITIVES -->
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
393
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
394 <xsl:template name="bug-local-name">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
395 <xsl:param name="id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
396 <xsl:value-of select="concat('bug',$id)" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
397 </xsl:template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
398
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
399
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
400 <xsl:template name="bug-reference">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
401 <xsl:param name="id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
402 <xsl:param name="referer" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
403
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
404 <xsl:variable name="refererPathFragment">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
405 <bug id="#root" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
406 <xsl:for-each select="$referer/ancestor-or-self::bug">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
407 <bug id="{@id}" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
408 </xsl:for-each>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
409 </xsl:variable>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
410 <xsl:variable name="targetPathFragment">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
411 <bug id="#root" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
412 <xsl:for-each
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
413 select="exsl:node-set($structure)//bug[@id = $id]/ancestor-or-self::bug">
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
414 <bug id="{@id}" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
415 </xsl:for-each>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
416 </xsl:variable>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
417 <xsl:variable name="path"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
418 select="exsl:node-set($refererPathFragment)/bug" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
419 <xsl:variable name="targetPath"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
420 select="exsl:node-set($targetPathFragment)/bug" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
421
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
422 <!-- find closest shared container id -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
423 <xsl:variable name="join"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
424 select="($path[@id = $targetPath/@id])[position() = last() ]/@id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
425
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
426 <!-- how many levels we need to up -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
427 <xsl:variable name="depth"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
428 select="count($path[@id = $join]/following-sibling::node())" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
429
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
430 <!-- DEBUG -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
431 <!-- <xsl:value-of select="concat('id=', $id, ',referer=', $referer/@id)"
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
432 /> <xsl:text>, path=</xsl:text> <xsl:for-each select="$targetPath"> <xsl:value-of
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
433 select="concat(name(),@id)" /> <xsl:if test="position() != last()"> <xsl:text>-</xsl:text>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
434 </xsl:if> </xsl:for-each> -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
435 <!-- DEBUG -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
436 <!-- <xsl:value-of select="concat(', join=', $join,', depth=', $depth,'
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
437 ')" /> -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
438
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
439 <!-- PRINT REFERENCE -->
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
440 <xsl:call-template name="repeat">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
441 <xsl:with-param name="value" select="'!'" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
442 <xsl:with-param name="count" select="$depth" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
443 </xsl:call-template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
444 <xsl:for-each select="$targetPath[@id = $join]/following-sibling::node()">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
445 <xsl:call-template name="bug-local-name">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
446 <xsl:with-param name="id" select="@id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
447 </xsl:call-template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
448 <xsl:if test="position() != last()">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
449 <xsl:text>.</xsl:text>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
450 </xsl:if>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
451 </xsl:for-each>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
452
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
453 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
454
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
455 <xsl:template name="start-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
456 <xsl:param name="indent" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
457 <xsl:param name="id" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
458 <xsl:param name="desc" />
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
459 <xsl:call-template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
460 <xsl:with-param name="indent" select="$indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
461 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
462 <xsl:text>task </xsl:text>
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
463 <xsl:value-of select="$id" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
464 <xsl:value-of select="concat(' &quot;',$desc,'&quot; {')" />
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
465 <xsl:call-template name="end-line" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
466 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
467
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
468 <xsl:template name="end-task">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
469 <xsl:param name="indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
470 <xsl:call-template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
471 <xsl:with-param name="indent" select="$indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
472 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
473 <xsl:text>}</xsl:text>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
474 <xsl:call-template name="end-line" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
475 </xsl:template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
476
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
477 <xsl:template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
478 <xsl:param name="indent" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
479 <xsl:if test="number($indent) > 0">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
480 <xsl:text> </xsl:text>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
481 <xsl:call-template name="begin-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
482 <xsl:with-param name="indent" select="$indent - 1" />
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
483 </xsl:call-template>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
484 </xsl:if>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
485 </xsl:template>
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
486
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
487 <xsl:template name="end-line">
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
488 <xsl:text>&#xa;</xsl:text>
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
489 </xsl:template>
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
490
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
491 <xsl:template name="repeat">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
492 <xsl:param name="value" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
493 <xsl:param name="count" select="0" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
494
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
495 <xsl:if test="number($count)">
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
496 <xsl:value-of select="$value" />
4
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
497 <xsl:call-template name="repeat">
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
498 <xsl:with-param name="value" select="$value" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
499 <xsl:with-param name="count" select="$count - 1" />
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
500 </xsl:call-template>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
501 </xsl:if>
f8f966388b68 xslt: bugzilla -> taskjuggler
cin
parents: 3
diff changeset
502 </xsl:template>
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
503
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
504 <xsl:template name="comment">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
505 <xsl:param name="indent" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
506 <xsl:param name="comment" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
507 <xsl:call-template name="println">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
508 <xsl:with-param name="indent" select="$indent" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
509 <xsl:with-param name="text">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
510 <xsl:text># </xsl:text>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
511 <xsl:value-of select="$comment" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
512 </xsl:with-param>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
513 </xsl:call-template>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
514 </xsl:template>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
515
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
516 <xsl:template name="println">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
517 <xsl:param name="indent" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
518 <xsl:param name="text" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
519 <xsl:call-template name="begin-line">
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
520 <xsl:with-param name="indent" select="$indent" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
521 </xsl:call-template>
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
522 <xsl:value-of select="$text" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
523 <xsl:call-template name="end-line" />
d2efec56373f working buglist transform and bugs fetching
cin
parents: 4
diff changeset
524 </xsl:template>
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
525 </xsl:stylesheet>