1 | <?xml version='1.0'?>
|
---|
2 | <!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
|
---|
3 | <!--#############################################################################
|
---|
4 | | $Id: sections.mod.xsl,v 1.8 2004/01/03 12:19:15 j-devenish Exp $
|
---|
5 | |- #############################################################################
|
---|
6 | | $Author: j-devenish $
|
---|
7 | + ############################################################################## -->
|
---|
8 |
|
---|
9 | <xsl:stylesheet
|
---|
10 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
11 | xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
|
---|
12 | exclude-result-prefixes="doc" version='1.0'>
|
---|
13 |
|
---|
14 | <doc:reference id="sections" xmlns="">
|
---|
15 | <referenceinfo>
|
---|
16 | <releaseinfo role="meta">
|
---|
17 | $Id: sections.mod.xsl,v 1.8 2004/01/03 12:19:15 j-devenish Exp $
|
---|
18 | </releaseinfo>
|
---|
19 | <authorgroup>
|
---|
20 | &ramon;
|
---|
21 | &james;
|
---|
22 | </authorgroup>
|
---|
23 | <copyright>
|
---|
24 | <year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year>
|
---|
25 | <holder>Ramon Casellas</holder>
|
---|
26 | </copyright>
|
---|
27 | <revhistory>
|
---|
28 | <doc:revision rcasver="1.6">&rev_2003_05;</doc:revision>
|
---|
29 | </revhistory>
|
---|
30 | </referenceinfo>
|
---|
31 | <title>Sections <filename>sections.mod.xsl</filename></title>
|
---|
32 | <partintro>
|
---|
33 | <para>The file <filename>sections.mod.xsl</filename> contains the
|
---|
34 | XSL templates for <doc:db>section</doc:db>, <doc:db>simplesect</doc:db>,
|
---|
35 | and <doc:db>sect1</doc:db>, etc.</para>
|
---|
36 | </partintro>
|
---|
37 | </doc:reference>
|
---|
38 |
|
---|
39 | <doc:template xmlns="">
|
---|
40 | <refpurpose>Process explicitly-nested sections</refpurpose>
|
---|
41 | <doc:description>
|
---|
42 | <para>
|
---|
43 | Formats a section's title (including numbering, if applicable)
|
---|
44 | then allows all child elements to be processed. The title
|
---|
45 | is formatted the using &LaTeX; mapping identified by the
|
---|
46 | element name (e.g. <doc:db>sect1</doc:db>, etc.).
|
---|
47 | </para>
|
---|
48 | </doc:description>
|
---|
49 | <doc:params>
|
---|
50 | <variablelist>
|
---|
51 | <varlistentry>
|
---|
52 | <term>bridgehead</term>
|
---|
53 | <listitem>
|
---|
54 | <para>
|
---|
55 |
|
---|
56 | If <literal>true()</literal>, the title is
|
---|
57 | processed like a <doc:db>bridgehead</doc:db> (that
|
---|
58 | is, the section is unnumbered and does not appear
|
---|
59 | in the <doc:db>toc</doc:db>). This parameter
|
---|
60 | defaults to <literal>false()</literal> unless the
|
---|
61 | section appears within a preface.
|
---|
62 |
|
---|
63 | </para>
|
---|
64 | </listitem>
|
---|
65 | </varlistentry>
|
---|
66 | </variablelist>
|
---|
67 | </doc:params>
|
---|
68 | <doc:variables>
|
---|
69 | &no_var;
|
---|
70 | </doc:variables>
|
---|
71 | <doc:notes>
|
---|
72 |
|
---|
73 | <para>Currently, <quote>info</quote> elements (e.g.
|
---|
74 | <doc:db>sect1info</doc:db>), <doc:db>subtitle</doc:db> and
|
---|
75 | <doc:db>titleabbrev</doc:db> are not honoured.</para>
|
---|
76 |
|
---|
77 | <para>The use of special components such as <doc:db>toc</doc:db>,
|
---|
78 | <doc:db>lot</doc:db>, <doc:db>index</doc:db> and
|
---|
79 | <doc:db>glossary</doc:db> is unlikely to be successful.</para>
|
---|
80 |
|
---|
81 | </doc:notes>
|
---|
82 | <doc:samples>
|
---|
83 | <simplelist type='inline'>
|
---|
84 | &test_article;
|
---|
85 | &test_book;
|
---|
86 | </simplelist>
|
---|
87 | </doc:samples>
|
---|
88 | <doc:seealso>
|
---|
89 | <itemizedlist>
|
---|
90 | <listitem><para>&mapping;</para></listitem>
|
---|
91 | </itemizedlist>
|
---|
92 | </doc:seealso>
|
---|
93 | </doc:template>
|
---|
94 |
|
---|
95 | <xsl:template match="sect1|sect2|sect3|sect4|sect5">
|
---|
96 | <xsl:param name="bridgehead" select="ancestor::preface|ancestor::colophon|ancestor::dedication|ancestor::partintro"/>
|
---|
97 | <xsl:variable name="template">
|
---|
98 | <xsl:value-of select="local-name(.)"/>
|
---|
99 | <xsl:if test="$bridgehead"><xsl:text>*</xsl:text></xsl:if>
|
---|
100 | </xsl:variable>
|
---|
101 | <xsl:call-template name="map.begin">
|
---|
102 | <xsl:with-param name="keyword" select="$template"/>
|
---|
103 | </xsl:call-template>
|
---|
104 | <xsl:call-template name="content-templates"/>
|
---|
105 | <xsl:call-template name="map.end">
|
---|
106 | <xsl:with-param name="keyword" select="$template"/>
|
---|
107 | </xsl:call-template>
|
---|
108 | </xsl:template>
|
---|
109 |
|
---|
110 | <doc:template xmlns="">
|
---|
111 | <refpurpose>Process recursive and leaf sections</refpurpose>
|
---|
112 | <doc:description>
|
---|
113 | <para>
|
---|
114 | Formats a section's title (including numbering, if applicable)
|
---|
115 | then allows all child elements to be processed. The title
|
---|
116 | is formatted the using &LaTeX; mapping identified by the
|
---|
117 | equivalent explicit element (e.g. <doc:db>sect1</doc:db>, etc.).
|
---|
118 | </para>
|
---|
119 | </doc:description>
|
---|
120 | <doc:params>
|
---|
121 | <variablelist>
|
---|
122 | <varlistentry>
|
---|
123 | <term>bridgehead</term>
|
---|
124 | <listitem>
|
---|
125 | <para>
|
---|
126 |
|
---|
127 | If <literal>true()</literal>, the title is
|
---|
128 | processed like a <doc:db>bridgehead</doc:db> (that
|
---|
129 | is, the section is unnumbered and does not appear
|
---|
130 | in the <doc:db>toc</doc:db>). This parameter
|
---|
131 | defaults to <literal>false()</literal> unless the
|
---|
132 | section appears within a preface.
|
---|
133 |
|
---|
134 | </para>
|
---|
135 | </listitem>
|
---|
136 | </varlistentry>
|
---|
137 | <varlistentry>
|
---|
138 | <term>level</term>
|
---|
139 | <listitem>
|
---|
140 | <para>
|
---|
141 |
|
---|
142 | The numeric nesting level of the section. This is
|
---|
143 | automatically calculated as "one greater than the
|
---|
144 | number of ancestor <doc:db>section</doc:db>s".
|
---|
145 |
|
---|
146 | </para>
|
---|
147 | </listitem>
|
---|
148 | </varlistentry>
|
---|
149 | </variablelist>
|
---|
150 | </doc:params>
|
---|
151 | <doc:variables>
|
---|
152 | &no_var;
|
---|
153 | </doc:variables>
|
---|
154 | <doc:notes>
|
---|
155 |
|
---|
156 | <para>Titles for sections nested beyond a depth of five are
|
---|
157 | formatted like <doc:db>sect5</doc:db>.</para>
|
---|
158 |
|
---|
159 | <para>Currently, <quote>info</quote> elements (e.g.
|
---|
160 | <doc:db>sectioninfo</doc:db>), <doc:db>subtitle</doc:db> and
|
---|
161 | <doc:db>titleabbrev</doc:db> are not honoured.</para>
|
---|
162 |
|
---|
163 | <para>The use of special components such as <doc:db>toc</doc:db>,
|
---|
164 | <doc:db>lot</doc:db>, <doc:db>index</doc:db> and
|
---|
165 | <doc:db>glossary</doc:db> is unlikely to be successful.</para>
|
---|
166 |
|
---|
167 | <para>&LaTeX; makes no semantic distinction between
|
---|
168 | <doc:db>section</doc:db> and <doc:db>simplesect</doc:db>.</para>
|
---|
169 |
|
---|
170 | </doc:notes>
|
---|
171 | <doc:samples>
|
---|
172 | <simplelist type='inline'>
|
---|
173 | &test_article;
|
---|
174 | &test_book;
|
---|
175 | </simplelist>
|
---|
176 | </doc:samples>
|
---|
177 | <doc:seealso>
|
---|
178 | <itemizedlist>
|
---|
179 | <listitem><para>&mapping;</para></listitem>
|
---|
180 | </itemizedlist>
|
---|
181 | </doc:seealso>
|
---|
182 | </doc:template>
|
---|
183 | <xsl:template match="section|simplesect">
|
---|
184 | <xsl:param name="bridgehead" select="ancestor::preface|ancestor::colophon|ancestor::dedication"/>
|
---|
185 | <xsl:param name="level" select="count(ancestor::section)+1"/>
|
---|
186 | <xsl:variable name="template">
|
---|
187 | <xsl:choose>
|
---|
188 | <xsl:when test='$level<6'>
|
---|
189 | <xsl:text>sect</xsl:text>
|
---|
190 | <xsl:value-of select="$level"/>
|
---|
191 | </xsl:when>
|
---|
192 | <xsl:otherwise>
|
---|
193 | <xsl:message>DB2LaTeX: recursive section|simplesect > 5 not well supported.</xsl:message>
|
---|
194 | <xsl:text>sect6</xsl:text>
|
---|
195 | </xsl:otherwise>
|
---|
196 | </xsl:choose>
|
---|
197 | <xsl:if test="$bridgehead"><xsl:text>*</xsl:text></xsl:if>
|
---|
198 | </xsl:variable>
|
---|
199 | <xsl:text> </xsl:text>
|
---|
200 | <xsl:call-template name="map.begin">
|
---|
201 | <xsl:with-param name="keyword" select="$template"/>
|
---|
202 | </xsl:call-template>
|
---|
203 | <xsl:call-template name="content-templates"/>
|
---|
204 | <xsl:call-template name="map.end">
|
---|
205 | <xsl:with-param name="keyword" select="$template"/>
|
---|
206 | </xsl:call-template>
|
---|
207 | </xsl:template>
|
---|
208 |
|
---|
209 | </xsl:stylesheet>
|
---|