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:d="http://docbook.org/ns/docbook" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="doc d" version="1.0">
3 <!-- ********************************************************************
5 This file is part of the XSL DocBook Stylesheet distribution.
6 See ../README or http://cdn.docbook.org/release/xsl/current/ for
7 copyright and other information.
9 ******************************************************************** -->
11 <doc:reference xmlns="">
12 <referenceinfo xmlns="http://www.w3.org/1999/xhtml">
13 <releaseinfo role="meta">
15 <author><surname>Walsh</surname>
16 <firstname>Norman</firstname></author>
17 <copyright><year>1999</year><year>2000</year>
18 <holder>Norman Walsh</holder>
21 <title xmlns="http://www.w3.org/1999/xhtml">HTML EBNF Reference</title>
23 <partintro xmlns="http://www.w3.org/1999/xhtml">
24 <section><title>Introduction</title>
26 <para>This is technical reference documentation for the DocBook XSL
27 Stylesheets; it documents (some of) the parameters, templates, and
28 other elements of the stylesheets.</para>
30 <para>This reference describes the templates and parameters relevant
31 to formatting EBNF markup.</para>
33 <para>This is not intended to be <quote>user</quote> documentation.
34 It is provided for developers writing customization layers for the
35 stylesheets, and for anyone who's interested in <quote>how it
38 <para>Although I am trying to be thorough, this documentation is known
39 to be incomplete. Don't forget to read the source, too :-)</para>
44 <!-- ==================================================================== -->
46 <xsl:template match="d:productionset">
47 <table width="100%" cellpadding="5">
48 <xsl:if test="$ebnf.table.bgcolor != ''">
49 <xsl:attribute name="bgcolor">
50 <xsl:value-of select="$ebnf.table.bgcolor"/>
53 <xsl:if test="$ebnf.table.border != 0">
54 <xsl:attribute name="border">1</xsl:attribute>
56 <xsl:attribute name="class">
57 <xsl:value-of select="local-name(.)"/>
59 <xsl:attribute name="summary">
60 <xsl:text>EBNF</xsl:text>
61 <xsl:if test="d:title|d:info/d:title">
62 <xsl:text> for </xsl:text>
63 <xsl:value-of select="d:title|d:info/d:title[1]"/>
67 <xsl:if test="d:title|d:info/d:title">
69 <th align="{$direction.align.start}" valign="top">
70 <xsl:apply-templates select="." mode="class.attribute"/>
71 <xsl:apply-templates select="d:title|d:info/d:title[1]"/>
77 <table border="0" width="99%" cellpadding="0">
78 <xsl:if test="$ebnf.table.bgcolor != ''">
79 <xsl:attribute name="bgcolor">
80 <xsl:value-of select="$ebnf.table.bgcolor"/>
83 <xsl:attribute name="class">
84 <xsl:value-of select="local-name(.)"/>
86 <xsl:attribute name="summary">EBNF productions</xsl:attribute>
87 <xsl:apply-templates select="d:production|d:productionrecap"/>
94 <xsl:template match="d:productionset/d:title">
95 <xsl:apply-templates/>
98 <xsl:template match="d:production">
99 <xsl:param name="recap" select="false()"/>
101 <td align="{$direction.align.start}" valign="top" width="3%">
102 <xsl:text>[</xsl:text>
103 <xsl:apply-templates select="." mode="label.markup"/>
104 <xsl:text>]</xsl:text>
106 <td align="{$direction.align.end}" valign="top" width="10%">
108 <xsl:when test="$recap">
110 <xsl:attribute name="href">
111 <xsl:call-template name="href.target">
112 <xsl:with-param name="object" select="."/>
115 <xsl:apply-templates select="d:lhs"/>
119 <xsl:call-template name="id.attribute"/>
120 <xsl:call-template name="anchor"/>
121 <xsl:apply-templates select="d:lhs"/>
125 <td valign="top" width="5%" align="center">
126 <xsl:copy-of select="$ebnf.assignment"/>
128 <td valign="top" width="52%">
129 <xsl:apply-templates select="d:rhs"/>
130 <xsl:copy-of select="$ebnf.statement.terminator"/>
132 <td align="{$direction.align.start}" valign="top" width="30%">
134 <xsl:when test="d:rhs/d:lineannotation|d:constraint">
135 <xsl:apply-templates select="d:rhs/d:lineannotation" mode="rhslo"/>
136 <xsl:apply-templates select="d:constraint"/>
139 <xsl:text> </xsl:text>
146 <xsl:template match="d:productionrecap">
147 <xsl:variable name="targets" select="key('id',@linkend)"/>
148 <xsl:variable name="target" select="$targets[1]"/>
150 <xsl:if test="count($targets)=0">
152 <xsl:text>Error: no ID for productionrecap linkend: </xsl:text>
153 <xsl:value-of select="@linkend"/>
154 <xsl:text>.</xsl:text>
158 <xsl:if test="count($targets)>1">
160 <xsl:text>Warning: multiple "IDs" for productionrecap linkend: </xsl:text>
161 <xsl:value-of select="@linkend"/>
162 <xsl:text>.</xsl:text>
166 <xsl:apply-templates select="$target">
167 <xsl:with-param name="recap" select="true()"/>
168 </xsl:apply-templates>
171 <xsl:template match="d:lhs">
172 <xsl:apply-templates/>
175 <xsl:template match="d:rhs">
176 <xsl:apply-templates/>
177 <xsl:if test="following-sibling::d:rhs">
178 <xsl:text> |</xsl:text>
183 <xsl:template match="d:nonterminal">
184 <xsl:variable name="linkend">
185 <xsl:call-template name="xpointer.idref">
186 <xsl:with-param name="xpointer" select="@def"/>
190 <xsl:call-template name="check.id.unique">
191 <xsl:with-param name="linkend" select="$linkend"/>
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>
199 <!-- If you don't provide content, you can't point outside this doc. -->
201 <xsl:when test="*|text()"><!--nop--></xsl:when>
203 <xsl:if test="$linkend = ''">
205 <xsl:text>Non-terminals with no content must point to </xsl:text>
206 <xsl:text>production elements in the current document.</xsl:text>
209 <xsl:text>Invalid xpointer for empty nt: </xsl:text>
210 <xsl:value-of select="@def"/>
216 <xsl:variable name="href">
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="href.target">
222 <xsl:with-param name="object" select="$target"/>
226 <xsl:value-of select="@def"/>
233 <xsl:when test="*|text()">
234 <xsl:apply-templates/>
238 <xsl:when test="$linkend != ''">
239 <xsl:variable name="targets" select="key('id',$linkend)"/>
240 <xsl:variable name="target" select="$targets[1]"/>
241 <xsl:apply-templates select="$target/d:lhs"/>
244 <xsl:text>???</xsl:text>
252 <xsl:template match="d:rhs/d:lineannotation">
256 <xsl:template match="d:rhs/d:lineannotation" mode="rhslo">
257 <xsl:text>/* </xsl:text>
258 <xsl:apply-templates/>
259 <xsl:text> */</xsl:text>
263 <xsl:template match="d:constraint">
264 <xsl:call-template name="check.id.unique">
265 <xsl:with-param name="linkend" select="@linkend"/>
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>
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="href.target">
277 <xsl:with-param name="object" select="$target"/>
281 <xsl:text>[ </xsl:text>
284 <xsl:when test="@role">
285 <xsl:value-of select="@role"/>
286 <xsl:text>: </xsl:text>
289 <xsl:variable name="targets" select="key('id',@linkend)"/>
290 <xsl:variable name="target" select="$targets[1]"/>
291 <xsl:if test="$target/@role">
292 <xsl:value-of select="$target/@role"/>
293 <xsl:text>: </xsl:text>
299 <xsl:variable name="targets" select="key('id',@linkend)"/>
300 <xsl:variable name="target" select="$targets[1]"/>
301 <xsl:apply-templates select="$target" mode="title.markup"/>
303 <xsl:text> ]</xsl:text>
304 <xsl:if test="following-sibling::d:constraint">
309 <xsl:template match="d:constraintdef">
311 <xsl:apply-templates select="." mode="class.attribute"/>
312 <xsl:call-template name="id.attribute"/>
313 <xsl:call-template name="anchor"/>
314 <xsl:apply-templates/>
318 <xsl:template match="d:constraintdef/d:title">
319 <p><strong><xsl:apply-templates/></strong></p>
322 <!-- ==================================================================== -->