1 | <?xml version="1.0" encoding="utf-8"?> |
---|
2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
3 | xmlns:fo="http://www.w3.org/1999/XSL/Format" |
---|
4 | version="1.0"> |
---|
5 | |
---|
6 | <!-- Import the FO stylesheet --> |
---|
7 | <xsl:import |
---|
8 | href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/> |
---|
9 | |
---|
10 | <xsl:param name="chapter.autolabel" select="0"/> |
---|
11 | <xsl:param name="refentry.generate.name" select="0"/> |
---|
12 | <xsl:param name="refentry.generate.title" select="1"/> |
---|
13 | <xsl:param name="fop.extensions" select="1"/> |
---|
14 | <xsl:param name="make.year.ranges" select="1"/> |
---|
15 | <xsl:param name="ulink.show" select="0"/> |
---|
16 | |
---|
17 | <!-- The question and answer templates are copied here from the |
---|
18 | 1.61.3 DocBook XSL stylesheets so that we can eliminate the emission |
---|
19 | of id attributes in the emitted fo:list-item-label elements. FOP |
---|
20 | 0.20.5 has problems with these id attributes, and they are otherwise |
---|
21 | unused. --> |
---|
22 | <xsl:template match="question"> |
---|
23 | <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable> |
---|
24 | |
---|
25 | <xsl:variable name="entry.id"> |
---|
26 | <xsl:call-template name="object.id"> |
---|
27 | <xsl:with-param name="object" select="parent::*"/> |
---|
28 | </xsl:call-template> |
---|
29 | </xsl:variable> |
---|
30 | |
---|
31 | <xsl:variable name="deflabel"> |
---|
32 | <xsl:choose> |
---|
33 | <xsl:when test="ancestor-or-self::*[@defaultlabel]"> |
---|
34 | <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] |
---|
35 | /@defaultlabel"/> |
---|
36 | </xsl:when> |
---|
37 | <xsl:otherwise> |
---|
38 | <xsl:value-of select="$qanda.defaultlabel"/> |
---|
39 | </xsl:otherwise> |
---|
40 | </xsl:choose> |
---|
41 | </xsl:variable> |
---|
42 | |
---|
43 | <fo:list-item id="{$entry.id}" xsl:use-attribute-sets="list.item.spacing"> |
---|
44 | <fo:list-item-label end-indent="label-end()"> |
---|
45 | <xsl:choose> |
---|
46 | <xsl:when test="$deflabel = 'none'"> |
---|
47 | <fo:block/> |
---|
48 | </xsl:when> |
---|
49 | <xsl:otherwise> |
---|
50 | <fo:block> |
---|
51 | <xsl:apply-templates select="." mode="label.markup"/> |
---|
52 | <xsl:text>.</xsl:text> <!-- FIXME: Hack!!! This should be in the locale! --> |
---|
53 | </fo:block> |
---|
54 | </xsl:otherwise> |
---|
55 | </xsl:choose> |
---|
56 | </fo:list-item-label> |
---|
57 | <fo:list-item-body start-indent="body-start()"> |
---|
58 | <xsl:choose> |
---|
59 | <xsl:when test="$deflabel = 'none'"> |
---|
60 | <fo:block font-weight="bold"> |
---|
61 | <xsl:apply-templates select="*[local-name(.)!='label']"/> |
---|
62 | </fo:block> |
---|
63 | </xsl:when> |
---|
64 | <xsl:otherwise> |
---|
65 | <xsl:apply-templates select="*[local-name(.)!='label']"/> |
---|
66 | </xsl:otherwise> |
---|
67 | </xsl:choose> |
---|
68 | </fo:list-item-body> |
---|
69 | </fo:list-item> |
---|
70 | </xsl:template> |
---|
71 | |
---|
72 | <xsl:template match="answer"> |
---|
73 | <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable> |
---|
74 | <xsl:variable name="entry.id"> |
---|
75 | <xsl:call-template name="object.id"> |
---|
76 | <xsl:with-param name="object" select="parent::*"/> |
---|
77 | </xsl:call-template> |
---|
78 | </xsl:variable> |
---|
79 | |
---|
80 | <xsl:variable name="deflabel"> |
---|
81 | <xsl:choose> |
---|
82 | <xsl:when test="ancestor-or-self::*[@defaultlabel]"> |
---|
83 | <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] |
---|
84 | /@defaultlabel"/> |
---|
85 | </xsl:when> |
---|
86 | <xsl:otherwise> |
---|
87 | <xsl:value-of select="$qanda.defaultlabel"/> |
---|
88 | </xsl:otherwise> |
---|
89 | </xsl:choose> |
---|
90 | </xsl:variable> |
---|
91 | |
---|
92 | <fo:list-item xsl:use-attribute-sets="list.item.spacing"> |
---|
93 | <fo:list-item-label end-indent="label-end()"> |
---|
94 | <xsl:choose> |
---|
95 | <xsl:when test="$deflabel = 'none'"> |
---|
96 | <fo:block/> |
---|
97 | </xsl:when> |
---|
98 | <xsl:otherwise> |
---|
99 | <fo:block> |
---|
100 | <!-- FIXME: Hack!!! This should be in the locale! --> |
---|
101 | <xsl:variable name="answer.label"> |
---|
102 | <xsl:apply-templates select="." mode="label.markup"/> |
---|
103 | </xsl:variable> |
---|
104 | <xsl:copy-of select="$answer.label"/> |
---|
105 | <xsl:if test="string($answer.label) != ''"> |
---|
106 | <xsl:text>.</xsl:text> |
---|
107 | </xsl:if> |
---|
108 | </fo:block> |
---|
109 | </xsl:otherwise> |
---|
110 | </xsl:choose> |
---|
111 | </fo:list-item-label> |
---|
112 | <fo:list-item-body start-indent="body-start()"> |
---|
113 | <xsl:apply-templates select="*[local-name(.)!='label']"/> |
---|
114 | </fo:list-item-body> |
---|
115 | </fo:list-item> |
---|
116 | </xsl:template> |
---|
117 | |
---|
118 | </xsl:stylesheet> |
---|