1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--####################################################################
| $Id: db2latex-mw-variablelist.xsl 146 2005-05-14 15:34:22Z mw $
| $Author: mw $
+ ################################################################# -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc" version="1.0">
<!-- DOCUMENTATION -->
<doc:reference id="variablelists" xmlns="">
<referenceinfo>
<releaseinfo role="meta">
$Id: db2latex-mw-variablelist.xsl 146 2005-05-14 15:34:22Z mw $
</releaseinfo>
<authorgroup>
<author><firstname>Michael</firstname> <surname>Wiedmann</surname></author>
</authorgroup>
<copyright>
<year>2004</year>
<holder>Michael Wiedmann</holder>
</copyright>
</referenceinfo>
<title>Lists <filename>db2latex-mw-variablelist.xsl</filename></title>
<partintro>
<section>
<title>Introduction</title>
<para>This customization of "variablelist" depends on the usage
of one of KOMA document classes (scrbook, scrartcl, etc.).
You have to ensure that your stylesheets outputs a
corresponding line, like "\documentclass{scrXXXX}".
</para>
<itemizedlist>
<listitem>
<simpara>If the attribute 'role' contains
'db2latex:multiterm' we use a 'parbox' for every
'item'. Otherwise the item's could be too long to
fit on one line.
Use this if your list contains many 'term's.
</simpara>
</listitem>
<listitem>
<simpara>If the attribute 'role' contains
'db2latex:nonoindent' we don't output '\noindent'
before the environment.
</simpara>
</listitem>
<listitem>
<simpara>If the 'role' attribute contains
'db2latex:labeling' as value we use KOMA's
'labeling' environment.
</simpara>
</listitem>
<listitem>
<simpara>If the attribute 'termlength' is
non-empty we use this numeric value as a hint
for 'labeling' for the width of the 'item's
(defaults to 5).
</simpara>
</listitem>
</itemizedlist>
</section>
</partintro>
</doc:reference>
<xsl:output method="text" encoding="ISO-8859-1" indent="yes"/>
<xsl:template match="variablelist">
<xsl:text>% MW: variablelist </xsl:text>
<xsl:variable name="helpstring">123456789012345</xsl:variable>
<xsl:if test="title">
<xsl:apply-templates select="title"/>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="contains(@role,'db2latex:nonoindent')">
<!-- noop -->
</xsl:when>
<xsl:otherwise>
<xsl:text>\noindent </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="contains(@role,'db2latex:labeling')">
<xsl:text>\begin{labeling}{</xsl:text>
<xsl:choose>
<xsl:when test="@termlength!=''">
<xsl:value-of select="substring($helpstring,1,number(@termlength))"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>12345</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>} </xsl:text>
<xsl:apply-templates select="varlistentry"/>
<xsl:text>\end{labeling} </xsl:text>
</xsl:when>
<xsl:when test="contains(@role,'db2latex:compact')">
<xsl:text>\begin{description*}</xsl:text>
<xsl:apply-templates select="varlistentry"/>
<xsl:text>\end{description*} </xsl:text>
</xsl:when>
<xsl:when test="contains(@role,'db2latex:multiterm')">
<xsl:text>\begin{description}</xsl:text>
<xsl:apply-templates select="varlistentry">
<xsl:with-param name="multiterm" select="1"/>
</xsl:apply-templates>
<xsl:text>\end{description} </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\begin{description} </xsl:text>
<xsl:apply-templates select="varlistentry"/>
<xsl:text>\end{description} </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="varlistentry">
<xsl:text> % MW: varlistentry </xsl:text>
<!-- <xsl:variable name="id"> -->
<xsl:call-template name="label.id" />
<!-- </xsl:variable> -->
<xsl:param name="multiterm" select="0" />
<xsl:text> % MW: varlistentry after label.id </xsl:text>
<xsl:text>% \null is a trick </xsl:text>
<xsl:choose>
<xsl:when test="$multiterm > 0">
<xsl:text>\item[{\parbox[b]{0.5\linewidth}{</xsl:text>
<xsl:for-each select="term">
<xsl:apply-templates/>
<xsl:if test="position()!=last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>}}]\null{}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\item[{</xsl:text>
<xsl:for-each select="term">
<xsl:apply-templates/>
<xsl:if test="position()!=last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>}]\null{}</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="listitem"/>
</xsl:template>
</xsl:stylesheet>
|