Lines 356-444
Link Here
|
356 |
<xsl:value-of select="count($anc.divs) + number($section.level)"/> |
356 |
<xsl:value-of select="count($anc.divs) + number($section.level)"/> |
357 |
</xsl:template> |
357 |
</xsl:template> |
358 |
|
358 |
|
359 |
<xsl:template name="question.answer.label"> |
|
|
360 |
<xsl:variable name="deflabel"> |
361 |
<xsl:choose> |
362 |
<xsl:when test="ancestor-or-self::*[@defaultlabel]"> |
363 |
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] |
364 |
/@defaultlabel"/> |
365 |
</xsl:when> |
366 |
<xsl:otherwise> |
367 |
<xsl:value-of select="$qanda.defaultlabel"/> |
368 |
</xsl:otherwise> |
369 |
</xsl:choose> |
370 |
</xsl:variable> |
371 |
|
372 |
<xsl:variable name="label" select="@label"/> |
373 |
|
374 |
<!-- |
375 |
(hnr (hierarchical-number-recursive (normalize "qandadiv") node)) |
376 |
|
377 |
(parsect (ancestor-member node (section-element-list))) |
378 |
|
379 |
(defnum (if (and %qanda-inherit-numeration% |
380 |
%section-autolabel%) |
381 |
(if (node-list-empty? parsect) |
382 |
(section-autolabel-prefix node) |
383 |
(section-autolabel parsect)) |
384 |
"")) |
385 |
|
386 |
(hnumber (let loop ((numlist hnr) (number defnum) |
387 |
(sep (if (equal? defnum "") "" "."))) |
388 |
(if (null? numlist) |
389 |
number |
390 |
(loop (cdr numlist) |
391 |
(string-append number |
392 |
sep |
393 |
(number->string (car numlist))) |
394 |
".")))) |
395 |
(cnumber (child-number (parent node))) |
396 |
(number (string-append hnumber |
397 |
(if (equal? hnumber "") |
398 |
"" |
399 |
".") |
400 |
(number->string cnumber)))) |
401 |
--> |
402 |
|
403 |
<xsl:choose> |
404 |
<xsl:when test="$deflabel = 'qanda'"> |
405 |
<xsl:call-template name="gentext"> |
406 |
<xsl:with-param name="key"> |
407 |
<xsl:choose> |
408 |
<xsl:when test="local-name(.) = 'question'">question</xsl:when> |
409 |
<xsl:when test="local-name(.) = 'answer'">answer</xsl:when> |
410 |
<xsl:when test="local-name(.) = 'qandadiv'">qandadiv</xsl:when> |
411 |
<xsl:otherwise>qandaset</xsl:otherwise> |
412 |
</xsl:choose> |
413 |
</xsl:with-param> |
414 |
</xsl:call-template> |
415 |
</xsl:when> |
416 |
<xsl:when test="$deflabel = 'label'"> |
417 |
<xsl:value-of select="$label"/> |
418 |
</xsl:when> |
419 |
<xsl:when test="$deflabel = 'number' |
420 |
and local-name(.) = 'question'"> |
421 |
<xsl:apply-templates select="ancestor::qandaset[1]" |
422 |
mode="number"/> |
423 |
<xsl:choose> |
424 |
<xsl:when test="ancestor::qandadiv"> |
425 |
<xsl:apply-templates select="ancestor::qandadiv[1]" |
426 |
mode="number"/> |
427 |
<xsl:apply-templates select="ancestor::qandaentry" |
428 |
mode="number"/> |
429 |
</xsl:when> |
430 |
<xsl:otherwise> |
431 |
<xsl:apply-templates select="ancestor::qandaentry" |
432 |
mode="number"/> |
433 |
</xsl:otherwise> |
434 |
</xsl:choose> |
435 |
</xsl:when> |
436 |
<xsl:otherwise> |
437 |
<!-- nothing --> |
438 |
</xsl:otherwise> |
439 |
</xsl:choose> |
440 |
</xsl:template> |
441 |
|
442 |
<xsl:template match="qandaset" mode="number"> |
359 |
<xsl:template match="qandaset" mode="number"> |
443 |
<!-- FIXME: --> |
360 |
<!-- FIXME: --> |
444 |
</xsl:template> |
361 |
</xsl:template> |