Debian Codegraph @

xsl/example.xsl

raw
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
3
4 <!--############################################################################
5 XSLT Stylesheet DocBook -> LaTeX
6 ############################################################################ -->
7
8 <xsl:param name="example.default.position">[H]</xsl:param>
9 <xsl:param name="example.float.type">none</xsl:param>
10
11
12 <xsl:template match="example">
13 <xsl:choose>
14 <xsl:when test="@floatstyle='none' or
15 (not(@floatstyle) and $example.float.type='none')">
16 <xsl:apply-templates select="." mode="block"/>
17 </xsl:when>
18 <xsl:otherwise>
19 <xsl:apply-templates select="." mode="float"/>
20 </xsl:otherwise>
21 </xsl:choose>
22 </xsl:template>
23
24 <xsl:template match="example" mode="block">
25 <xsl:text>&#10;\begin{longfloat}{example}{</xsl:text>
26 <!-- caption -->
27 <xsl:apply-templates select="title"/>
28 <xsl:text>}&#10;</xsl:text>
29 <xsl:apply-templates select="*[not(self::title)]"/>
30 <xsl:text>&#10;\end{longfloat}&#10;</xsl:text>
31 </xsl:template>
32
33 <xsl:template match="example" mode="float">
34 <xsl:text>&#10;\begin{example}</xsl:text>
35 <!-- float placement preference -->
36 <xsl:choose>
37 <xsl:when test="@floatstyle != ''">
38 <xsl:value-of select="@floatstyle"/>
39 </xsl:when>
40 <xsl:otherwise>
41 <xsl:value-of select="$example.default.position"/>
42 </xsl:otherwise>
43 </xsl:choose>
44 <xsl:text>&#10;</xsl:text>
45 <xsl:apply-templates select="*[not(self::title)]"/>
46 <!-- caption -->
47 <xsl:apply-templates select="title"/>
48 <xsl:text>&#10;\end{example}&#10;</xsl:text>
49 </xsl:template>
50
51 <xsl:template match="informalexample">
52 <xsl:call-template name="label.id"/>
53 <xsl:apply-templates/>
54 </xsl:template>
55
56 <xsl:template match="example/title">
57 <xsl:text>\caption</xsl:text>
58 <xsl:apply-templates select="." mode="format.title"/>
59 <xsl:call-template name="label.id">
60 <xsl:with-param name="object" select="parent::example"/>
61 </xsl:call-template>
62 </xsl:template>
63
64 </xsl:stylesheet>