1 <?xml version=
"1.0" encoding=
"utf-8"?>
3 Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
9 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
12 <xsl:output method=
"xml" indent=
"yes" standalone=
"yes"/>
14 <xsl:strip-space elements=
"sequence-group or-group element element-name"/>
16 <xsl:key name=
"elements" match=
"element" use=
"@name"/>
17 <xsl:key name=
"attributes" match=
"attlist" use=
"@name"/>
18 <xsl:key name=
"attribute-purposes" match=
"attpurpose" use=
"@name"/>
20 <xsl:template match=
"dtd">
21 <section id=
"reference">
22 <title>Reference
</title>
24 <xsl:text>Elements:
</xsl:text>
25 <itemizedlist spacing=
"compact">
26 <xsl:apply-templates select=
"element" mode=
"synopsis">
27 <xsl:sort select=
"@name"/>
28 </xsl:apply-templates>
31 <xsl:apply-templates select=
"element"/>
35 <!-- Element synopsis -->
36 <xsl:template match=
"element" mode=
"synopsis">
40 <xsl:attribute name=
"linkend">
41 <xsl:value-of select=
"concat('boostbook.dtd.',@name)"/>
43 <xsl:text>Element
</xsl:text>
44 <sgmltag><xsl:value-of select=
"@name"/></sgmltag>
45 <xsl:text> -
</xsl:text>
46 <xsl:apply-templates select=
"purpose"/>
52 <!-- Elements are transformed into DocBook refentry elements -->
53 <xsl:template match=
"element">
55 <xsl:attribute name=
"id">
56 <xsl:value-of select=
"concat('boostbook.dtd.',@name)"/>
61 BoostBook element
<sgmltag><xsl:value-of select=
"@name"/></sgmltag>
63 <manvolnum>9</manvolnum>
66 <refname><xsl:value-of select=
"@name"/></refname>
67 <refpurpose><xsl:apply-templates select=
"purpose"/></refpurpose>
70 <xsl:value-of select=
"@name"/><xsl:text> ::=
</xsl:text>
71 <xsl:apply-templates select=
"content-model-expanded"/>
73 <xsl:apply-templates select=
"description"/>
74 <xsl:apply-templates select=
"key('attributes', @name)"/>
78 <xsl:template match=
"content-model-expanded">
79 <xsl:apply-templates/>
83 <xsl:template match=
"sequence-group">
84 <xsl:param name=
"separator" select=
"''"/>
86 <xsl:if test=
"preceding-sibling::*">
87 <xsl:value-of select=
"$separator"/>
89 <xsl:text>(
</xsl:text>
91 <xsl:with-param name=
"separator" select=
"', '"/>
92 </xsl:apply-templates>
93 <xsl:text>)
</xsl:text>
94 <xsl:value-of select=
"@occurrence"/>
98 <xsl:template match=
"or-group">
99 <xsl:param name=
"separator" select=
"''"/>
101 <xsl:if test=
"preceding-sibling::*">
102 <xsl:value-of select=
"$separator"/>
104 <xsl:text>(
</xsl:text>
105 <xsl:apply-templates>
106 <xsl:with-param name=
"separator" select=
"'| '"/>
107 </xsl:apply-templates>
108 <xsl:text>)
</xsl:text>
109 <xsl:value-of select=
"@occurrence"/>
112 <!-- Element references -->
113 <xsl:template match=
"element-name">
114 <xsl:param name=
"separator" select=
"''"/>
116 <xsl:if test=
"preceding-sibling::*">
117 <xsl:value-of select=
"$separator"/>
120 <xsl:variable name=
"element-node" select=
"key('elements', @name)"/>
123 <xsl:when test=
"$element-node">
125 <xsl:attribute name=
"linkend">
126 <xsl:value-of select=
"concat('boostbook.dtd.',@name)"/>
128 <xsl:value-of select=
"@name"/>
132 <xsl:value-of select=
"@name"/>
135 <xsl:value-of select=
"@occurrence"/>
139 <xsl:template match=
"pcdata">
140 <xsl:param name=
"separator" select=
"''"/>
142 <xsl:if test=
"preceding-sibling::*">
143 <xsl:value-of select=
"$separator"/>
146 <xsl:text>#PCDATA
</xsl:text>
150 <xsl:template match=
"any">
151 <xsl:text>ANY
</xsl:text>
155 <xsl:template match=
"empty">
156 <xsl:text>EMPTY
</xsl:text>
159 <!-- Just copy anything in a purpose element -->
160 <xsl:template match=
"purpose">
161 <xsl:copy-of select=
"text()|*"/>
164 <!-- Just copy anything in a description element, but place it in a
166 <xsl:template match=
"description">
168 <title>Description
</title>
169 <xsl:copy-of select=
"text()|*"/>
174 <xsl:template match=
"attlist">
176 <title>Attributes
</title>
185 <entry>Purpose
</entry>
189 <xsl:apply-templates/>
197 <xsl:template match=
"attribute">
199 <entry><xsl:value-of select=
"@name"/></entry>
200 <entry><xsl:value-of select=
"@type"/></entry>
201 <entry><xsl:value-of select=
"@value"/></entry>
204 <xsl:when test=
"purpose">
205 <xsl:apply-templates select=
"purpose"/>
208 <xsl:apply-templates select=
"key('attribute-purposes', @name)"/>
215 <!-- Eat attribute declarations -->
216 <xsl:template match=
"attdecl"/>