source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/xhtml-1_1/ebnf.xsl@ 58675ce

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