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