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