2 <!--#############################################################################
3 |- #############################################################################
6 + ############################################################################## -->
9 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
10 xmlns:
doc=
"http://nwalsh.com/xsl/documentation/1.0"
11 exclude-result-prefixes=
"doc" version='
1.0'
>
15 <!--############################################################################# -->
16 <!-- DOCUMENTATION -->
17 <doc:reference id=
"lists" xmlns=
"">
19 <releaseinfo role=
"meta">
22 <author> <firstname>Ramon
</firstname> <surname>Casellas
</surname> </author>
23 <author> <firstname>James
</firstname> <surname>Devenish
</surname> </author>
26 <year>2000</year> <year>2001</year> <year>2002</year> <year>2003</year>
27 <holder>Ramon Casellas
</holder>
31 <title>Lists
<filename>lists.mod.xsl
</filename></title>
33 <section><title>Introduction
</title>
41 <xsl:template match=
"variablelist/title| orderedlist/title | itemizedlist/title | simplelist/title">
42 <xsl:text> {\sc
</xsl:text>
43 <xsl:apply-templates/>
44 <xsl:text>}
</xsl:text>
48 <xsl:template match=
"itemizedlist">
49 <xsl:if test=
"title"> <xsl:apply-templates select=
"title"/></xsl:if>
50 <xsl:text> \begin{itemize}
</xsl:text>
51 <xsl:apply-templates select=
"listitem"/>
52 <xsl:text> \end{itemize}
</xsl:text>
56 <xsl:template match=
"orderedlist">
57 <xsl:variable name=
"numeration">
59 <xsl:when test=
"@numeration">
60 <xsl:value-of select=
"@numeration"/>
63 <xsl:value-of select=
"arabic"/>
67 <xsl:if test=
"title"> <xsl:apply-templates select=
"title"/></xsl:if>
68 <xsl:text> \begin{enumerate}
</xsl:text>
69 <xsl:if test=
"@numeration">
71 <xsl:when test=
"@numeration='arabic'"> <xsl:text>[
1]
</xsl:text> </xsl:when>
72 <xsl:when test=
"@numeration='upperalpha'"><xsl:text>[A]
</xsl:text> </xsl:when>
73 <xsl:when test=
"@numeration='loweralpha'"><xsl:text>[a]
</xsl:text> </xsl:when>
74 <xsl:when test=
"@numeration='upperroman'"><xsl:text>[I]
</xsl:text> </xsl:when>
75 <xsl:when test=
"@numeration='lowerroman'"><xsl:text>[i]
</xsl:text> </xsl:when>
78 <xsl:apply-templates select=
"listitem"/>
84 <xsl:template match=
"variablelist">
86 <xsl:apply-templates select=
"title"/>
88 <xsl:text> \noindent
</xsl:text>
89 <xsl:text> \begin{description}
</xsl:text>
90 <xsl:apply-templates select=
"varlistentry"/>
91 <xsl:text> \end{description}
</xsl:text>
95 <xsl:template match=
"listitem">
96 <xsl:text> %--- Item
</xsl:text>
97 <xsl:text>\item
</xsl:text>
98 <xsl:apply-templates/>
99 <xsl:text> </xsl:text>
103 <xsl:template match=
"varlistentry">
104 <xsl:variable name=
"id">
105 <xsl:call-template name=
"label.id"/>
107 <xsl:text>\item[
</xsl:text><xsl:apply-templates select=
"term"/><xsl:text>]\mbox{} % mbox is a trick to induce different typesetting decisions
</xsl:text>
108 <xsl:apply-templates select=
"listitem"/>
112 <xsl:template match=
"varlistentry/term">
113 <xsl:apply-templates/><xsl:text>,
</xsl:text>
116 <xsl:template match=
"varlistentry/term[position()=last()]">
117 <xsl:apply-templates/>
120 <xsl:template match=
"varlistentry/listitem">
121 <xsl:apply-templates/>
125 <xsl:template name=
"tabular.string">
126 <xsl:param name=
"cols" select=
"1"/>
127 <xsl:param name=
"i" select=
"1"/>
129 <xsl:when test=
"$i > $cols"></xsl:when>
131 <xsl:text>l
</xsl:text>
132 <xsl:call-template name=
"tabular.string">
133 <xsl:with-param name=
"i" select=
"$i+1"/>
134 <xsl:with-param name=
"cols" select=
"$cols"/>
141 <!--==========================================================================
142 | Inline simplelist. It is rendered as a list of comma separated values.
143 | We make the difference between the last member and the rest. XSL easily
145 +============================================================================-->
147 <xsl:template match=
"simplelist[@type='inline']">
148 <xsl:apply-templates/>
150 <xsl:template match=
"simplelist[@type='inline']/member">
151 <xsl:apply-templates/>
152 <xsl:text>,
</xsl:text>
154 <xsl:template match=
"simplelist[@type='inline']/member[position()=last()]">
155 <xsl:apply-templates/>
158 <xsl:template match=
"simplelist[@type='horiz']">
159 <xsl:variable name=
"cols">
161 <xsl:when test=
"@columns">
162 <xsl:value-of select=
"@columns"/>
164 <xsl:otherwise>1</xsl:otherwise>
167 <xsl:text> </xsl:text>
168 <xsl:text>\begin{tabular*}{\linewidth}{
</xsl:text>
169 <xsl:call-template name=
"tabular.string">
170 <xsl:with-param name=
"cols" select=
"$cols"/>
172 <xsl:text>}
</xsl:text>
173 <xsl:call-template name=
"simplelist.horiz">
174 <xsl:with-param name=
"cols" select=
"$cols"/>
176 <xsl:text> \end{tabular*}
</xsl:text>
182 <xsl:template name=
"simplelist.horiz">
183 <xsl:param name=
"cols">1</xsl:param>
184 <xsl:param name=
"cell">1</xsl:param>
185 <xsl:param name=
"members" select=
"./member"/>
186 <xsl:if test=
"$cell <= count($members)">
187 <xsl:text> </xsl:text>
188 <xsl:call-template name=
"simplelist.horiz.row">
189 <xsl:with-param name=
"cols" select=
"$cols"/>
190 <xsl:with-param name=
"cell" select=
"$cell"/>
191 <xsl:with-param name=
"members" select=
"$members"/>
193 <xsl:text> \\
</xsl:text>
194 <xsl:call-template name=
"simplelist.horiz">
195 <xsl:with-param name=
"cols" select=
"$cols"/>
196 <xsl:with-param name=
"cell" select=
"$cell + $cols"/>
197 <xsl:with-param name=
"members" select=
"$members"/>
202 <xsl:template name=
"simplelist.horiz.row">
203 <xsl:param name=
"cols">1</xsl:param>
204 <xsl:param name=
"cell">1</xsl:param>
205 <xsl:param name=
"members" select=
"./member"/>
206 <xsl:param name=
"curcol">1</xsl:param>
207 <xsl:if test=
"$curcol <= $cols">
209 <xsl:when test=
"$members[position()=$cell]">
210 <xsl:apply-templates select=
"$members[position()=$cell]"/>
211 <xsl:text> </xsl:text>
212 <xsl:if test=
"$curcol < $cols">
213 <xsl:call-template name=
"generate.latex.cell.separator"/>
217 <xsl:call-template name=
"simplelist.horiz.row">
218 <xsl:with-param name=
"cols" select=
"$cols"/>
219 <xsl:with-param name=
"cell" select=
"$cell+1"/>
220 <xsl:with-param name=
"members" select=
"$members"/>
221 <xsl:with-param name=
"curcol" select=
"$curcol+1"/>
236 <xsl:template match=
"simplelist|simplelist[@type='vert']">
237 <xsl:variable name=
"cols">
239 <xsl:when test=
"@columns">
240 <xsl:value-of select=
"@columns"/>
242 <xsl:otherwise>1</xsl:otherwise>
245 <xsl:text> </xsl:text>
246 <!--<xsl:text>\vspace{1cm} </xsl:text>-->
247 <xsl:text>\begin{tabular*}{\linewidth}{
</xsl:text>
248 <xsl:call-template name=
"tabular.string">
249 <xsl:with-param name=
"i" select=
"1"/>
250 <xsl:with-param name=
"cols" select=
"$cols"/>
252 <xsl:text>}
</xsl:text>
253 <xsl:call-template name=
"simplelist.vert">
254 <xsl:with-param name=
"cols" select=
"$cols"/>
256 <xsl:text> \end{tabular*}
</xsl:text>
257 <!--<xsl:text>\vspace{1cm} </xsl:text>-->
262 <xsl:template name=
"simplelist.vert">
263 <xsl:param name=
"cols">1</xsl:param>
264 <xsl:param name=
"cell">1</xsl:param>
265 <xsl:param name=
"members" select=
"./member"/>
266 <xsl:param name=
"rows" select=
"floor((count($members)+$cols - 1) div $cols)"/>
267 <xsl:if test=
"$cell <= $rows">
268 <xsl:text> </xsl:text>
269 <xsl:call-template name=
"simplelist.vert.row">
270 <xsl:with-param name=
"cols" select=
"$cols"/>
271 <xsl:with-param name=
"rows" select=
"$rows"/>
272 <xsl:with-param name=
"cell" select=
"$cell"/>
273 <xsl:with-param name=
"members" select=
"$members"/>
275 <xsl:text> \\
</xsl:text>
276 <xsl:call-template name=
"simplelist.vert">
277 <xsl:with-param name=
"cols" select=
"$cols"/>
278 <xsl:with-param name=
"cell" select=
"$cell+1"/>
279 <xsl:with-param name=
"members" select=
"$members"/>
280 <xsl:with-param name=
"rows" select=
"$rows"/>
287 <xsl:template name=
"simplelist.vert.row">
288 <xsl:param name=
"cols">1</xsl:param>
289 <xsl:param name=
"rows">1</xsl:param>
290 <xsl:param name=
"cell">1</xsl:param>
291 <xsl:param name=
"members" select=
"./member"/>
292 <xsl:param name=
"curcol">1</xsl:param>
293 <xsl:if test=
"$curcol <= $cols">
295 <xsl:when test=
"$members[position()=$cell]">
296 <xsl:apply-templates select=
"$members[position()=$cell]"/>
297 <xsl:text> </xsl:text>
298 <xsl:if test=
"$curcol < $cols">
299 <xsl:call-template name=
"generate.latex.cell.separator"/>
305 <xsl:call-template name=
"simplelist.vert.row">
306 <xsl:with-param name=
"cols" select=
"$cols"/>
307 <xsl:with-param name=
"rows" select=
"$rows"/>
308 <xsl:with-param name=
"cell" select=
"$cell+$rows"/>
309 <xsl:with-param name=
"members" select=
"$members"/>
310 <xsl:with-param name=
"curcol" select=
"$curcol+1"/>
316 <xsl:template match=
"member">
317 <xsl:apply-templates/>
323 <xsl:template match=
"segmentedlist">
324 <xsl:apply-templates/>
327 <xsl:template match=
"segmentedlist/title">
328 <xsl:text> {\sc
</xsl:text>
329 <xsl:apply-templates/>
330 <xsl:text>} \\
</xsl:text>
333 <xsl:template match=
"segtitle">
336 <xsl:template match=
"segtitle" mode=
"segtitle-in-seg">
337 <xsl:apply-templates/>
340 <xsl:template match=
"seglistitem">
341 <xsl:apply-templates/>
343 <xsl:when test=
"position()=last()"><xsl:text> </xsl:text></xsl:when>
344 <xsl:otherwise><xsl:text> \\
</xsl:text></xsl:otherwise>
351 <xsl:template match=
"seg">
352 <xsl:variable name=
"segnum" select=
"position()"/>
353 <xsl:variable name=
"seglist" select=
"ancestor::segmentedlist"/>
354 <xsl:variable name=
"segtitles" select=
"$seglist/segtitle"/>
357 Note: segtitle is only going to be the right thing in a well formed
358 SegmentedList. If there are too many Segs or too few SegTitles,
359 you'll get something odd...maybe an error
362 <xsl:text>{ \em
</xsl:text>
363 <xsl:apply-templates select=
"$segtitles[$segnum=position()]" mode=
"segtitle-in-seg"/>
364 <xsl:text>:}
</xsl:text>
365 <xsl:apply-templates/>
377 <!-- ==================================================================== -->
379 <xsl:template match=
"calloutlist">
380 <xsl:if test=
"./title">
381 <xsl:apply-templates select=
"./title" mode=
"calloutlist.title.mode"/>
383 <xsl:apply-templates/>
386 <xsl:template match=
"calloutlist/title">
389 <xsl:template match=
"calloutlist/title" mode=
"calloutlist.title.mode">
390 <xsl:apply-templates/>
393 <xsl:template match=
"callout">
395 <xsl:call-template name=
"callout.arearefs">
396 <xsl:with-param name=
"arearefs" select=
"@arearefs"/>
399 <dl><xsl:apply-templates/></dl>
402 <xsl:template name=
"callout.arearefs">
403 <xsl:param name=
"arearefs"></xsl:param>
404 <xsl:if test=
"$arearefs!=''">
406 <xsl:when test=
"substring-before($arearefs,' ')=''">
407 <xsl:call-template name=
"callout.arearef">
408 <xsl:with-param name=
"arearef" select=
"$arearefs"/>
412 <xsl:call-template name=
"callout.arearef">
413 <xsl:with-param name=
"arearef"
414 select=
"substring-before($arearefs,' ')"/>
418 <xsl:call-template name=
"callout.arearefs">
419 <xsl:with-param name=
"arearefs"
420 select=
"substring-after($arearefs,' ')"/>
429 <xsl:template name=
"callout.arearef">
430 <xsl:param name=
"arearef"></xsl:param>
431 <xsl:variable name=
"targets" select=
"//node()[@id=$arearef]"/>
432 <xsl:variable name=
"target" select=
"$targets[1]"/>
434 <xsl:when test=
"count($target)=0">
435 <xsl:value-of select=
"$arearef"/>
436 <xsl:text>callout ???
</xsl:text>
438 <xsl:when test=
"local-name($target)='co'">
440 <xsl:text>\href{
</xsl:text>
441 <xsl:value-of select=
"$target/@id"/>
442 <xsl:text>}{
</xsl:text>
443 <xsl:value-of select=
"$target/@id"/><xsl:text>}
</xsl:text>
446 <xsl:text>callout ???
</xsl:text>