~todd-deshane/openstack-manuals/working

« back to all changes in this revision

Viewing changes to doc/build/docbook-xsl-1.76.1/xhtml/ebnf.xsl

  • Committer: Anne Gentle
  • Date: 2011-04-04 17:54:52 UTC
  • Revision ID: anne@openstack.org-20110404175452-gtth3hfrniqhpp5o
Switching from Ant builds to Maven, still working out kinks but should be functional

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 8178 2008-12-15 22:26:38Z 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 8178 2008-12-15 22:26:38Z 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
33
 
Stylesheets; it documents (some of) the parameters, templates, and
34
 
other elements of the stylesheets.</para>
35
 
 
36
 
<para>This reference describes the templates and parameters relevant
37
 
to formatting EBNF markup.</para>
38
 
 
39
 
<para>This is not intended to be <quote>user</quote> documentation.
40
 
It is provided for developers writing customization layers for the
41
 
stylesheets, and for anyone who's interested in <quote>how it
42
 
works</quote>.</para>
43
 
 
44
 
<para>Although I am trying to be thorough, this documentation is known
45
 
to 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">
68
 
        <xsl:text> for </xsl:text>
69
 
        <xsl:value-of select="title"/>
70
 
      </xsl:if>
71
 
    </xsl:attribute>
72
 
 
73
 
    <xsl:if test="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"/>
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:number count="production" level="any"/>
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="anchor"/>
126
 
          <xsl:apply-templates select="lhs"/>
127
 
        </xsl:otherwise>
128
 
      </xsl:choose>
129
 
    </td>
130
 
    <td valign="top" width="5%" align="center">
131
 
      <xsl:copy-of select="$ebnf.assignment"/>
132
 
    </td>
133
 
    <td valign="top" width="52%">
134
 
      <xsl:apply-templates select="rhs"/>
135
 
      <xsl:copy-of select="$ebnf.statement.terminator"/>
136
 
    </td>
137
 
    <td align="{$direction.align.start}" valign="top" width="30%">
138
 
      <xsl:choose>
139
 
        <xsl:when test="rhs/lineannotation|constraint">
140
 
          <xsl:apply-templates select="rhs/lineannotation" mode="rhslo"/>
141
 
          <xsl:apply-templates select="constraint"/>
142
 
        </xsl:when>
143
 
        <xsl:otherwise>
144
 
          <xsl:text>&#160;</xsl:text>
145
 
        </xsl:otherwise>
146
 
      </xsl:choose>
147
 
    </td>
148
 
  </tr>
149
 
</xsl:template>
150
 
 
151
 
<xsl:template match="productionrecap">
152
 
  <xsl:variable name="targets" select="key('id',@linkend)"/>
153
 
  <xsl:variable name="target" select="$targets[1]"/>
154
 
 
155
 
  <xsl:if test="count($targets)=0">
156
 
    <xsl:message>
157
 
      <xsl:text>Error: no ID for productionrecap linkend: </xsl:text>
158
 
      <xsl:value-of select="@linkend"/>
159
 
      <xsl:text>.</xsl:text>
160
 
    </xsl:message>
161
 
  </xsl:if>
162
 
 
163
 
  <xsl:if test="count($targets)&gt;1">
164
 
    <xsl:message>
165
 
      <xsl:text>Warning: multiple "IDs" for productionrecap linkend: </xsl:text>
166
 
      <xsl:value-of select="@linkend"/>
167
 
      <xsl:text>.</xsl:text>
168
 
    </xsl:message>
169
 
  </xsl:if>
170
 
 
171
 
  <xsl:apply-templates select="$target">
172
 
    <xsl:with-param name="recap" select="true()"/>
173
 
  </xsl:apply-templates>
174
 
</xsl:template>
175
 
 
176
 
<xsl:template match="lhs">
177
 
  <xsl:apply-templates/>
178
 
</xsl:template>
179
 
 
180
 
<xsl:template match="rhs">
181
 
  <xsl:apply-templates/>
182
 
  <xsl:if test="following-sibling::rhs">
183
 
    <xsl:text> |</xsl:text>
184
 
    <br/>
185
 
  </xsl:if>
186
 
</xsl:template>
187
 
 
188
 
<xsl:template match="nonterminal">
189
 
  <xsl:variable name="linkend">
190
 
    <xsl:call-template name="xpointer.idref">
191
 
      <xsl:with-param name="xpointer" select="@def"/>
192
 
    </xsl:call-template>
193
 
  </xsl:variable>
194
 
 
195
 
  <xsl:call-template name="check.id.unique">
196
 
    <xsl:with-param name="linkend" select="$linkend"/>
197
 
  </xsl:call-template>
198
 
 
199
 
  <xsl:call-template name="check.idref.targets">
200
 
    <xsl:with-param name="linkend" select="$linkend"/>
201
 
    <xsl:with-param name="element-list">production</xsl:with-param>
202
 
  </xsl:call-template>
203
 
 
204
 
  <!-- If you don't provide content, you can't point outside this doc. -->
205
 
  <xsl:choose>
206
 
    <xsl:when test="*|text()"><!--nop--></xsl:when>
207
 
    <xsl:otherwise>
208
 
      <xsl:if test="$linkend = ''">
209
 
        <xsl:message>
210
 
          <xsl:text>Non-terminals with no content must point to </xsl:text>
211
 
          <xsl:text>production elements in the current document.</xsl:text>
212
 
        </xsl:message>
213
 
        <xsl:message>
214
 
          <xsl:text>Invalid xpointer for empty nt: </xsl:text>
215
 
          <xsl:value-of select="@def"/>
216
 
        </xsl:message>
217
 
      </xsl:if>
218
 
    </xsl:otherwise>
219
 
  </xsl:choose>
220
 
 
221
 
  <xsl:variable name="href">
222
 
    <xsl:choose>
223
 
      <xsl:when test="$linkend != ''">
224
 
        <xsl:variable name="targets" select="key('id',$linkend)"/>
225
 
        <xsl:variable name="target" select="$targets[1]"/>
226
 
        <xsl:call-template name="href.target">
227
 
          <xsl:with-param name="object" select="$target"/>
228
 
        </xsl:call-template>
229
 
      </xsl:when>
230
 
      <xsl:otherwise>
231
 
        <xsl:value-of select="@def"/>
232
 
      </xsl:otherwise>
233
 
    </xsl:choose>
234
 
  </xsl:variable>
235
 
 
236
 
  <a href="{$href}">
237
 
    <xsl:choose>
238
 
      <xsl:when test="*|text()">
239
 
        <xsl:apply-templates/>
240
 
      </xsl:when>
241
 
      <xsl:otherwise>
242
 
        <xsl:choose>
243
 
          <xsl:when test="$linkend != ''">
244
 
            <xsl:variable name="targets" select="key('id',$linkend)"/>
245
 
            <xsl:variable name="target" select="$targets[1]"/>
246
 
            <xsl:apply-templates select="$target/lhs"/>
247
 
          </xsl:when>
248
 
          <xsl:otherwise>
249
 
            <xsl:text>???</xsl:text>
250
 
          </xsl:otherwise>
251
 
        </xsl:choose>
252
 
      </xsl:otherwise>
253
 
    </xsl:choose>
254
 
  </a>
255
 
</xsl:template>
256
 
 
257
 
<xsl:template match="rhs/lineannotation">
258
 
  <!--nop-->
259
 
</xsl:template>
260
 
 
261
 
<xsl:template match="rhs/lineannotation" mode="rhslo">
262
 
  <xsl:text>/*&#160;</xsl:text>
263
 
  <xsl:apply-templates/>
264
 
  <xsl:text>&#160;*/</xsl:text>
265
 
  <br/>
266
 
</xsl:template>
267
 
 
268
 
<xsl:template match="constraint">
269
 
  <xsl:call-template name="check.id.unique">
270
 
    <xsl:with-param name="linkend" select="@linkend"/>
271
 
  </xsl:call-template>
272
 
 
273
 
  <xsl:call-template name="check.idref.targets">
274
 
    <xsl:with-param name="linkend" select="@linkend"/>
275
 
    <xsl:with-param name="element-list">constraintdef</xsl:with-param>
276
 
  </xsl:call-template>
277
 
 
278
 
  <xsl:variable name="href">
279
 
    <xsl:variable name="targets" select="key('id',@linkend)"/>
280
 
    <xsl:variable name="target" select="$targets[1]"/>
281
 
    <xsl:call-template name="href.target">
282
 
      <xsl:with-param name="object" select="$target"/>
283
 
    </xsl:call-template>
284
 
  </xsl:variable>
285
 
 
286
 
  <xsl:text>[&#160;</xsl:text>
287
 
 
288
 
  <xsl:choose>
289
 
    <xsl:when test="@role">
290
 
      <xsl:value-of select="@role"/>
291
 
      <xsl:text>: </xsl:text>
292
 
    </xsl:when>
293
 
    <xsl:otherwise>
294
 
      <xsl:variable name="targets" select="key('id',@linkend)"/>
295
 
      <xsl:variable name="target" select="$targets[1]"/>
296
 
      <xsl:if test="$target/@role">
297
 
        <xsl:value-of select="$target/@role"/>
298
 
        <xsl:text>: </xsl:text>
299
 
      </xsl:if>
300
 
    </xsl:otherwise>
301
 
  </xsl:choose>
302
 
 
303
 
  <a href="{$href}">
304
 
    <xsl:variable name="targets" select="key('id',@linkend)"/>
305
 
    <xsl:variable name="target" select="$targets[1]"/>
306
 
    <xsl:apply-templates select="$target" mode="title.markup"/>
307
 
  </a>
308
 
  <xsl:text>&#160;]</xsl:text>
309
 
  <xsl:if test="following-sibling::constraint">
310
 
    <br/>
311
 
  </xsl:if>
312
 
</xsl:template>
313
 
 
314
 
<xsl:template match="constraintdef">
315
 
  <div>
316
 
    <xsl:apply-templates select="." mode="class.attribute"/>
317
 
    <xsl:call-template name="anchor"/>
318
 
    <xsl:apply-templates/>
319
 
  </div>
320
 
</xsl:template>
321
 
 
322
 
<xsl:template match="constraintdef/title">
323
 
  <p><strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></strong></p>
324
 
</xsl:template>
325
 
 
326
 
<!-- ==================================================================== -->
327
 
 
328
 
</xsl:stylesheet>