~ubuntu-branches/ubuntu/wily/dblatex/wily

« back to all changes in this revision

Viewing changes to xsl/refentry.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Hoenen
  • Date: 2008-08-11 20:28:56 UTC
  • mfrom: (4.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080811202856-d2qjg24ut53mgufx
Tags: 0.2.9-3
* Improve CJK (Chinese/Japanese/Korean) support:
  + Let XSL configuration parameter cjk.font default to gkai (instead of the
    cyberbit font not included in Debian).
  + Add Suggests dependency on latex-cjk-all for the gkai fonts.
  + Fix the db2latex style not to collide with the CJKutf8.sty file.
  Thanks to W. Martin Borgert for reporting and hints.
  Closes: #482857, #492350
* Fix a name clash with TeXLive for spanish documents in native style.
  Thanks to W. Martin Borgert for reporting.  Closes: #492304
* Support underscore characters in xreflabel attributes.  Thanks to
  Sébastien Villemot for reporting.  Closes: #492959

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
<!--############################################################################
5
5
    XSLT Stylesheet DocBook -> LaTeX 
6
6
    ############################################################################ -->
 
7
<xsl:param name="refentry.tocdepth">5</xsl:param>
 
8
<xsl:param name="refentry.numbered">1</xsl:param>
 
9
 
 
10
 
 
11
<xsl:template name="refsect.level">
 
12
  <xsl:param name="n" select="."/>
 
13
  <xsl:variable name="level">
 
14
    <xsl:call-template name="get.sect.level">
 
15
      <xsl:with-param name="n" select="$n/ancestor::refentry"/>
 
16
    </xsl:call-template>
 
17
  </xsl:variable>
 
18
  
 
19
  <xsl:variable name="offset">
 
20
    <xsl:choose>
 
21
    <xsl:when test="local-name($n)='refsynopsisdiv'">1</xsl:when>
 
22
    <xsl:when test="local-name($n)='refsect1'">1</xsl:when>
 
23
    <xsl:when test="local-name($n)='refsect2'">2</xsl:when>
 
24
    <xsl:when test="local-name($n)='refsect3'">3</xsl:when>
 
25
    <xsl:when test="local-name($n)='refsection'">
 
26
      <xsl:value-of select="count($n/ancestor::refsection)+1"/>
 
27
    </xsl:when>
 
28
    <xsl:otherwise>1</xsl:otherwise>
 
29
    </xsl:choose>
 
30
  </xsl:variable>
 
31
  <xsl:value-of select="$level + $offset"/>
 
32
</xsl:template>
7
33
 
8
34
<!-- #############
9
35
     # reference #
13
39
  <xsl:text>&#10;</xsl:text>
14
40
  <xsl:text>% Reference &#10;</xsl:text>
15
41
  <xsl:text>% ---------&#10;</xsl:text>
16
 
  <xsl:call-template name="element.and.label"/>
 
42
  <xsl:call-template name="mapheading"/>
17
43
  <xsl:apply-templates select="partintro"/>
18
44
  <xsl:apply-templates select="*[local-name(.) != 'partintro']"/>
19
45
</xsl:template>
47
73
  <xsl:text>% Refentry &#10;</xsl:text>
48
74
  <xsl:text>% ---------&#10;</xsl:text>
49
75
 
50
 
  <xsl:call-template name="map.sect.level">
51
 
    <xsl:with-param name="level">
52
 
      <xsl:call-template name="get.sect.level"/>
53
 
    </xsl:with-param>
54
 
  </xsl:call-template>
55
 
  <xsl:text>{</xsl:text>
56
 
  <xsl:value-of select="$title"/>
57
 
  <xsl:text>}&#10;</xsl:text>
58
 
  <xsl:call-template name="label.id"/>
59
 
  <xsl:apply-templates/>
60
 
</xsl:template>
61
 
 
62
 
<xsl:template match="refmeta"/>
 
76
  <xsl:variable name="level">
 
77
    <xsl:call-template name="get.sect.level"/>
 
78
  </xsl:variable>
 
79
 
 
80
  <xsl:choose>
 
81
  <xsl:when test="$refentry.numbered = '0'">
 
82
    <!-- Unumbered refentry title (but in TOC) -->
 
83
    <xsl:call-template name="section.unnumbered">
 
84
      <xsl:with-param name="level" select="$level"/>
 
85
      <xsl:with-param name="title" select="$title"/>
 
86
      <xsl:with-param name="tocdepth" select="$refentry.tocdepth"/>
 
87
    </xsl:call-template>
 
88
  </xsl:when>
 
89
  <xsl:otherwise>
 
90
    <!-- Numbered refentry title -->
 
91
    <xsl:call-template name="maketitle">
 
92
      <xsl:with-param name="level" select="$level"/>
 
93
      <xsl:with-param name="title" select="$title"/>
 
94
    </xsl:call-template>
 
95
    <xsl:apply-templates/>
 
96
  </xsl:otherwise>
 
97
  </xsl:choose>
 
98
</xsl:template>
 
99
 
 
100
<xsl:template match="refmeta">
 
101
  <xsl:apply-templates select="indexterm"/>
 
102
</xsl:template>
63
103
 
64
104
<xsl:template match="refentrytitle">
65
105
  <xsl:call-template name="inline.charseq"/>
77
117
     # refsynopsis #
78
118
     ############### -->
79
119
 
 
120
<!-- A refsynopsisdiv with a title is handled like a refsectx -->
80
121
<xsl:template match="refsynopsisdiv">
81
 
  <xsl:text>&#10;\subsection*{</xsl:text>
82
 
  <xsl:choose>
83
 
  <xsl:when test="title">
84
 
    <xsl:value-of select="title"/>
85
 
  </xsl:when>
86
 
  <xsl:otherwise>
87
 
    <xsl:value-of select="$refsynopsis.title"/>
88
 
  </xsl:otherwise>
89
 
  </xsl:choose>
 
122
  <xsl:call-template name="map.sect.level">
 
123
    <xsl:with-param name="num" select="'0'"/>
 
124
    <xsl:with-param name="level">
 
125
      <xsl:call-template name="refsect.level"/>
 
126
    </xsl:with-param>
 
127
  </xsl:call-template>
 
128
  <xsl:text>{</xsl:text>
 
129
  <xsl:value-of select="$refsynopsis.title"/>
90
130
  <xsl:text>}&#10;</xsl:text>
91
131
  <xsl:call-template name="label.id"/>
92
132
  <xsl:apply-templates/>
100
140
     ############## -->
101
141
 
102
142
<xsl:template match="refnamediv">
103
 
  <xsl:text>&#10;\subsection*{</xsl:text>
 
143
  <xsl:call-template name="map.sect.level">
 
144
    <xsl:with-param name="num" select="'0'"/>
 
145
    <xsl:with-param name="level">
 
146
      <xsl:call-template name="refsect.level"/>
 
147
    </xsl:with-param>
 
148
  </xsl:call-template>
 
149
  <xsl:text>{</xsl:text>
104
150
  <xsl:choose>
105
 
  <xsl:when test="$refnamediv.title=''">
106
 
    <xsl:call-template name="gentext.element.name">
107
 
      <xsl:with-param name="element.name" select="'refname'"/>
108
 
    </xsl:call-template>
109
 
  </xsl:when>
110
 
  <xsl:otherwise>
111
 
    <xsl:value-of select= "$refnamediv.title"/>
112
 
  </xsl:otherwise>
 
151
    <xsl:when test="$refnamediv.title=''">
 
152
      <xsl:call-template name="gentext.element.name">
 
153
        <xsl:with-param name="element.name" select="'refname'"/>
 
154
      </xsl:call-template>
 
155
    </xsl:when>
 
156
    <xsl:otherwise>
 
157
      <xsl:value-of select= "$refnamediv.title"/>
 
158
    </xsl:otherwise>
113
159
  </xsl:choose>
114
160
  <xsl:text>}</xsl:text>
115
161
  <xsl:call-template name="label.id"/>
155
201
     # refsectx #
156
202
     ############ -->
157
203
 
158
 
<xsl:template match="refsect1|refsect2|refsect3">
159
 
  <xsl:call-template name="element.and.label"/>
160
 
  <xsl:apply-templates/>
161
 
</xsl:template>
162
 
 
163
204
<xsl:template match="refsect1/title"/>
164
205
<xsl:template match="refsect2/title"/>
165
206
<xsl:template match="refsect3/title"/>
168
209
<xsl:template match="refsect2info"/>
169
210
<xsl:template match="refsect3info"/>
170
211
 
171
 
<xsl:template match="refsection">
172
 
  <xsl:call-template name="map.sect.level">
173
 
    <!-- its starts from subsection, so level+1 -->
174
 
    <xsl:with-param name="level" select="count(ancestor::refsection)+2"/>
 
212
<xsl:template match="refsection|refsect1|refsect2|refsect3|
 
213
                     refsynopsisdiv[title]">
 
214
  <xsl:call-template name="makeheading">
 
215
    <xsl:with-param name="level">
 
216
      <xsl:call-template name="refsect.level"/>
 
217
    </xsl:with-param>
175
218
    <xsl:with-param name="num" select="0"/>
176
219
  </xsl:call-template>
177
 
  <xsl:call-template name="title.and.label"/>
178
220
  <xsl:apply-templates/>
179
221
</xsl:template>
180
222