source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/fo/ebnf.xsl@ 15c7d39

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 15c7d39 was 15c7d39, checked in by Matthew Burgess <matthew@…>, 11 years ago

Update stylesheets to docbook-xsl-1.78.1.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10355 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 10.5 KB
Line 
1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
5 exclude-result-prefixes="doc"
6 version='1.0'>
7
8<!-- ********************************************************************
9 $Id: ebnf.xsl 9664 2012-11-07 20:02:17Z bobstayton $
10 ********************************************************************
11
12 This file is part of the XSL DocBook Stylesheet distribution.
13 See ../README or http://docbook.sf.net/release/xsl/current/ for
14 copyright and other information.
15
16 ******************************************************************** -->
17
18<doc:reference xmlns="">
19<referenceinfo>
20<releaseinfo role="meta">
21$Id: ebnf.xsl 9664 2012-11-07 20:02:17Z bobstayton $
22</releaseinfo>
23<author><surname>Walsh</surname>
24<firstname>Norman</firstname></author>
25<copyright><year>1999</year><year>2000</year><year>2001</year>
26<holder>Norman Walsh</holder>
27</copyright>
28</referenceinfo>
29<title>HTML EBNF Reference</title>
30
31<partintro>
32<section><title>Introduction</title>
33
34<para>This is technical reference documentation for the DocBook XSL
35Stylesheets; it documents (some of) the parameters, templates, and
36other elements of the stylesheets.</para>
37
38<para>This reference describes the templates and parameters relevant
39to formatting EBNF markup.</para>
40
41<para>This is not intended to be <quote>user</quote> documentation.
42It is provided for developers writing customization layers for the
43stylesheets, and for anyone who's interested in <quote>how it
44works</quote>.</para>
45
46<para>Although I am trying to be thorough, this documentation is known
47to be incomplete. Don't forget to read the source, too :-)</para>
48</section>
49</partintro>
50</doc:reference>
51
52<!-- ==================================================================== -->
53
54<xsl:template match="productionset">
55 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
56
57 <xsl:choose>
58 <xsl:when test="title">
59 <fo:block id="{$id}" xsl:use-attribute-sets="formal.object.properties">
60 <xsl:call-template name="formal.object.heading">
61 <xsl:with-param name="placement" select="'before'"/>
62 </xsl:call-template>
63
64 <fo:table table-layout="fixed" width="100%">
65 <fo:table-column column-number="1" column-width="3%"/>
66 <fo:table-column column-number="2" column-width="15%"/>
67 <fo:table-column column-number="3" column-width="5%"/>
68 <fo:table-column column-number="4" column-width="52%"/>
69 <fo:table-column column-number="5" column-width="25%"/>
70 <fo:table-body start-indent="0pt" end-indent="0pt">
71 <xsl:apply-templates select="production|productionrecap"/>
72 </fo:table-body>
73 </fo:table>
74 </fo:block>
75 </xsl:when>
76 <xsl:otherwise>
77 <fo:table id="{$id}" table-layout="fixed" width="100%">
78 <fo:table-column column-number="1" column-width="3%"/>
79 <fo:table-column column-number="2" column-width="15%"/>
80 <fo:table-column column-number="3" column-width="5%"/>
81 <fo:table-column column-number="4" column-width="52%"/>
82 <fo:table-column column-number="5" column-width="25%"/>
83 <fo:table-body start-indent="0pt" end-indent="0pt">
84 <xsl:apply-templates select="production|productionrecap"/>
85 </fo:table-body>
86 </fo:table>
87 </xsl:otherwise>
88 </xsl:choose>
89</xsl:template>
90
91<xsl:template match="productionset/title">
92 <!-- suppressed -->
93</xsl:template>
94
95<xsl:template match="production">
96 <xsl:param name="recap" select="false()"/>
97 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
98 <fo:table-row>
99 <fo:table-cell>
100 <fo:block text-align="start">
101 <xsl:text>[</xsl:text>
102 <xsl:apply-templates select="." mode="label.markup"/>
103 <xsl:text>]</xsl:text>
104 </fo:block>
105 </fo:table-cell>
106 <fo:table-cell>
107 <fo:block text-align="end">
108 <xsl:choose>
109 <xsl:when test="$recap">
110 <fo:basic-link internal-destination="{$id}"
111 xsl:use-attribute-sets="xref.properties">
112 <xsl:apply-templates select="lhs"/>
113 </fo:basic-link>
114 </xsl:when>
115 <xsl:otherwise>
116 <fo:wrapper id="{$id}">
117 <xsl:apply-templates select="lhs"/>
118 </fo:wrapper>
119 </xsl:otherwise>
120 </xsl:choose>
121 </fo:block>
122 </fo:table-cell>
123 <fo:table-cell>
124 <fo:block text-align="center">
125 <xsl:copy-of select="$ebnf.assignment"/>
126 </fo:block>
127 </fo:table-cell>
128 <fo:table-cell>
129 <fo:block>
130 <xsl:apply-templates select="rhs"/>
131 <xsl:copy-of select="$ebnf.statement.terminator"/>
132 </fo:block>
133 </fo:table-cell>
134 <fo:table-cell border-start-width="3pt">
135 <fo:block text-align="start">
136 <xsl:choose>
137 <xsl:when test="rhs/lineannotation|constraint">
138 <xsl:apply-templates select="rhs/lineannotation" mode="rhslo"/>
139 <xsl:apply-templates select="constraint"/>
140 </xsl:when>
141 <xsl:otherwise>
142 <xsl:text>&#160;</xsl:text>
143 </xsl:otherwise>
144 </xsl:choose>
145 </fo:block>
146 </fo:table-cell>
147 </fo:table-row>
148</xsl:template>
149
150<xsl:template match="productionrecap">
151 <xsl:variable name="targets" select="key('id',@linkend)"/>
152 <xsl:variable name="target" select="$targets[1]"/>
153
154 <xsl:if test="count($targets)=0">
155 <xsl:message>
156 <xsl:text>Error: no ID for productionrecap linkend: </xsl:text>
157 <xsl:value-of select="@linkend"/>
158 <xsl:text>.</xsl:text>
159 </xsl:message>
160 </xsl:if>
161
162 <xsl:if test="count($targets)>1">
163 <xsl:message>
164 <xsl:text>Warning: multiple "IDs" for productionrecap linkend: </xsl:text>
165 <xsl:value-of select="@linkend"/>
166 <xsl:text>.</xsl:text>
167 </xsl:message>
168 </xsl:if>
169
170 <xsl:apply-templates select="$target">
171 <xsl:with-param name="recap" select="true()"/>
172 </xsl:apply-templates>
173</xsl:template>
174
175<xsl:template match="lhs">
176 <xsl:apply-templates/>
177</xsl:template>
178
179<xsl:template match="rhs">
180 <xsl:apply-templates/>
181</xsl:template>
182
183<xsl:template match="nonterminal">
184 <xsl:variable name="linkend">
185 <xsl:call-template name="xpointer.idref">
186 <xsl:with-param name="xpointer" select="@def"/>
187 </xsl:call-template>
188 </xsl:variable>
189
190 <xsl:call-template name="check.id.unique">
191 <xsl:with-param name="linkend" select="$linkend"/>
192 </xsl:call-template>
193
194 <xsl:call-template name="check.idref.targets">
195 <xsl:with-param name="linkend" select="$linkend"/>
196 <xsl:with-param name="element-list">production</xsl:with-param>
197 </xsl:call-template>
198
199 <!-- If you don't provide content, you can't point outside this doc. -->
200 <xsl:choose>
201 <xsl:when test="*|text()"><!--nop--></xsl:when>
202 <xsl:otherwise>
203 <xsl:if test="$linkend = ''">
204 <xsl:message>
205 <xsl:text>Non-terminals with no content must point to </xsl:text>
206 <xsl:text>production elements in the current document.</xsl:text>
207 </xsl:message>
208 <xsl:message>
209 <xsl:text>Invalid xpointer for empty nt: </xsl:text>
210 <xsl:value-of select="@def"/>
211 </xsl:message>
212 </xsl:if>
213 </xsl:otherwise>
214 </xsl:choose>
215
216 <xsl:variable name="href">
217 <xsl:choose>
218 <xsl:when test="$linkend != ''">
219 <xsl:variable name="targets" select="key('id',$linkend)"/>
220 <xsl:variable name="target" select="$targets[1]"/>
221 <xsl:call-template name="object.id">
222 <xsl:with-param name="object" select="$target"/>
223 </xsl:call-template>
224 </xsl:when>
225 <xsl:otherwise>
226 <xsl:value-of select="@def"/>
227 </xsl:otherwise>
228 </xsl:choose>
229 </xsl:variable>
230
231 <fo:basic-link internal-destination="{$href}"
232 xsl:use-attribute-sets="xref.properties">
233 <xsl:choose>
234 <xsl:when test="*|text()">
235 <xsl:apply-templates/>
236 </xsl:when>
237 <xsl:otherwise>
238 <xsl:choose>
239 <xsl:when test="$linkend != ''">
240 <xsl:variable name="targets" select="key('id',$linkend)"/>
241 <xsl:variable name="target" select="$targets[1]"/>
242 <xsl:apply-templates select="$target/lhs"/>
243 </xsl:when>
244 <xsl:otherwise>
245 <xsl:text>???</xsl:text>
246 </xsl:otherwise>
247 </xsl:choose>
248 </xsl:otherwise>
249 </xsl:choose>
250 </fo:basic-link>
251</xsl:template>
252
253<xsl:template match="rhs/lineannotation">
254 <!--nop-->
255</xsl:template>
256
257<xsl:template match="rhs/lineannotation" mode="rhslo">
258 <xsl:text>/*&#160;</xsl:text>
259 <xsl:apply-templates/>
260 <xsl:text>&#160;*/</xsl:text>
261</xsl:template>
262
263<xsl:template match="constraint">
264 <xsl:call-template name="check.id.unique">
265 <xsl:with-param name="linkend" select="@linkend"/>
266 </xsl:call-template>
267
268 <xsl:call-template name="check.idref.targets">
269 <xsl:with-param name="linkend" select="@linkend"/>
270 <xsl:with-param name="element-list">constraintdef</xsl:with-param>
271 </xsl:call-template>
272
273 <xsl:variable name="href">
274 <xsl:variable name="targets" select="key('id',@linkend)"/>
275 <xsl:variable name="target" select="$targets[1]"/>
276 <xsl:call-template name="object.id">
277 <xsl:with-param name="object" select="$target"/>
278 </xsl:call-template>
279 </xsl:variable>
280
281 <xsl:if test="preceding-sibling::constraint">
282 <fo:inline linefeed-treatment="preserve">&#xA;</fo:inline>
283 </xsl:if>
284 <xsl:text>[&#160;</xsl:text>
285
286 <xsl:choose>
287 <xsl:when test="@role">
288 <xsl:value-of select="@role"/>
289 <xsl:text>: </xsl:text>
290 </xsl:when>
291 <xsl:otherwise>
292 <xsl:variable name="targets" select="key('id',@linkend)"/>
293 <xsl:variable name="target" select="$targets[1]"/>
294 <xsl:if test="$target/@role">
295 <xsl:value-of select="$target/@role"/>
296 <xsl:text>: </xsl:text>
297 </xsl:if>
298 </xsl:otherwise>
299 </xsl:choose>
300
301 <fo:basic-link internal-destination="{$href}"
302 xsl:use-attribute-sets="xref.properties">
303 <xsl:variable name="targets" select="key('id',@linkend)"/>
304 <xsl:variable name="target" select="$targets[1]"/>
305 <xsl:apply-templates select="$target" mode="title.markup"/>
306 </fo:basic-link>
307 <xsl:text>&#160;]</xsl:text>
308</xsl:template>
309
310<xsl:template match="constraintdef">
311 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
312 <fo:block id="{$id}">
313 <xsl:apply-templates/>
314 </fo:block>
315</xsl:template>
316
317<xsl:template match="constraintdef/title">
318 <fo:block font-weight="bold">
319 <xsl:apply-templates/>
320 </fo:block>
321</xsl:template>
322
323<!-- ==================================================================== -->
324
325</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.