source: trunk/third/libxslt/doc/api.xsl @ 20733

Revision 20733, 7.4 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r20732, which included commits to RCS files with non-trunk default branches.
Line 
1<?xml version="1.0"?>
2<!-- this stylesheet builds the API*.html , it works based on libxml2-refs.xml
3  -->
4<xsl:stylesheet version="1.0"
5  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6  xmlns:exsl="http://exslt.org/common"
7  extension-element-prefixes="exsl"
8  exclude-result-prefixes="exsl">
9
10  <!-- Import the rest of the site stylesheets -->
11  <xsl:import href="site.xsl"/>
12
13  <!-- Generate XHTML-1.0 transitional -->
14  <xsl:output method="xml" encoding="ISO-8859-1" indent="yes"
15      doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
16      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
17
18  <xsl:param name="libname" select="'libxslt'"/>
19  <xsl:param name="dirname" select="''"/>
20  <xsl:param name="logo_base" select="''"/>
21
22  <!-- href_base controls URI's in site.xsl as well as this stylesheet -->
23  <xsl:variable name="href_base" select="''"/>
24
25  <xsl:variable name="apirefs" select="document(concat($dirname, $libname, '-refs.xml'))"/>
26  <xsl:variable name="module" select="$apirefs/apirefs/@name"/>
27  <xsl:key name="refhref" match="reference" use="@name"/>
28
29  <xsl:template match="ref" mode="anchor">
30    <xsl:variable name="name" select="@name"/>
31    <xsl:for-each select="document(concat($dirname, $libname, '-refs.xml'))">
32        <a href="{key('refhref', $name)/@href}"><xsl:value-of select="$name"/></a><br/>
33    </xsl:for-each>
34  </xsl:template>
35
36  <xsl:template match="type" mode="reflist">
37    <h2>Type <xsl:value-of select="@name"/>:</h2>
38    <p>
39      <xsl:for-each select="ref">
40        <xsl:apply-templates mode="anchor" select="."/>
41        <xsl:text>
42</xsl:text>
43      </xsl:for-each>
44    </p>
45  </xsl:template>
46
47  <xsl:template match="letter" mode="reflist">
48    <h2>Letter <xsl:value-of select="@name"/>:</h2>
49    <p>
50      <xsl:for-each select="ref">
51        <xsl:apply-templates mode="anchor" select="."/>
52        <xsl:text>
53</xsl:text>
54      </xsl:for-each>
55    </p>
56  </xsl:template>
57
58  <xsl:template match="file" mode="reflist">
59    <h2><a name="{@name}">Module <xsl:value-of select="@name"/></a>:</h2>
60    <p>
61      <xsl:for-each select="ref">
62        <xsl:apply-templates mode="anchor" select="."/>
63        <xsl:text>
64</xsl:text>
65      </xsl:for-each>
66    </p>
67  </xsl:template>
68  <xsl:template match="letter" mode="wordlist">
69    <h2>Letter <xsl:value-of select="@name"/>:</h2>
70    <dl>
71      <xsl:for-each select="word">
72        <dt><xsl:value-of select="@name"/></dt>
73        <dd>
74        <xsl:for-each select="ref">
75          <xsl:apply-templates mode="anchor" select="."/>
76          <xsl:text>
77</xsl:text>
78        </xsl:for-each>
79        </dd>
80      </xsl:for-each>
81    </dl>
82  </xsl:template>
83
84  <xsl:template match="constructors">
85    <xsl:message>Generating API Constructors</xsl:message>
86    <xsl:variable name="title">List of constructors for <xsl:value-of select="$module"/></xsl:variable>
87    <xsl:variable name="doref">
88      <xsl:apply-templates mode="reflist" select="type"/>
89    </xsl:variable>
90    <xsl:call-template name="new_page">
91      <xsl:with-param name="filename" select="'APIconstructors.html'"/>
92      <xsl:with-param name="title" select="$title"/>
93      <xsl:with-param name="target" select="$doref"/>
94    </xsl:call-template>
95  </xsl:template>
96
97  <xsl:template match="files">
98    <xsl:message>Generating API List of symbols per file</xsl:message>
99    <xsl:variable name="title">List of Symbols per Module for <xsl:value-of select="$module"/></xsl:variable>
100    <xsl:variable name="doref">
101      <xsl:apply-templates mode="reflist" select="file"/>
102    </xsl:variable>
103    <xsl:call-template name="new_page">
104      <xsl:with-param name="filename" select="'APIfiles.html'"/>
105      <xsl:with-param name="title" select="$title"/>
106      <xsl:with-param name="target" select="$doref"/>
107    </xsl:call-template>
108  </xsl:template>
109
110  <xsl:template match="functions">
111    <xsl:message>Generating API Functions by Type</xsl:message>
112    <xsl:variable name="title">List of function manipulating types in <xsl:value-of select="$module"/></xsl:variable>
113    <xsl:variable name="doref">
114      <xsl:apply-templates mode="reflist" select="type"/>
115    </xsl:variable>
116    <xsl:call-template name="new_page">
117      <xsl:with-param name="filename" select="'APIfunctions.html'"/>
118      <xsl:with-param name="title" select="$title"/>
119      <xsl:with-param name="target" select="$doref"/>
120    </xsl:call-template>
121  </xsl:template>
122
123  <xsl:template match="alpha">
124    <xsl:message>Generating API Alphabetic list</xsl:message>
125    <xsl:variable name="title">Alphabetic List of Symbols in <xsl:value-of select="$module"/></xsl:variable>
126    <xsl:variable name="doref">
127      <xsl:apply-templates mode="reflist" select="letter"/>
128    </xsl:variable>
129    <xsl:call-template name="new_page">
130      <xsl:with-param name="filename" select="'APIsymbols.html'"/>
131      <xsl:with-param name="title" select="$title"/>
132      <xsl:with-param name="target" select="$doref"/>
133    </xsl:call-template>
134  </xsl:template>
135
136  <xsl:template name="apichunks">
137    <h2 align="center">
138    <xsl:for-each select="/apirefs/index/chunks/chunk">
139      <xsl:variable name="name" select="@name"/>
140      <xsl:variable name="start" select="@start"/>
141      <xsl:variable name="end" select="@end"/>
142      <xsl:variable name="block" select="concat($start, '-', $end)"/>
143      <a href="API{$name}.html"><xsl:value-of select="$block"/></a>
144      <xsl:text>
145</xsl:text>
146    </xsl:for-each>
147    </h2>
148  </xsl:template>
149
150  <xsl:template match="chunk">
151    <xsl:variable name="name" select="@name"/>
152    <xsl:variable name="start" select="@start"/>
153    <xsl:variable name="end" select="@end"/>
154    <xsl:variable name="block" select="concat($start, '-', $end)"/>
155    <xsl:variable name="target" select="/apirefs/index/chunk[@name = $name]"/>
156    <xsl:variable name="title">API Alphabetic Index <xsl:value-of select="$block"/> for <xsl:value-of select="$module"/></xsl:variable>
157    <xsl:variable name="dochunk">
158      <xsl:call-template name="apichunks"/>
159      <xsl:apply-templates mode="wordlist" select="$target/letter"/>
160      <xsl:call-template name="apichunks"/>
161    </xsl:variable>
162    <xsl:call-template name="new_page">
163      <xsl:with-param name="filename" select="concat('API', $name, '.html')"/>
164      <xsl:with-param name="title" select="$title"/>
165      <xsl:with-param name="target" select="$dochunk"/>
166    </xsl:call-template>
167  </xsl:template>
168
169  <xsl:template match="index">
170    <xsl:message>Generating API Index</xsl:message>
171    <xsl:apply-templates select="chunks/chunk"/>
172  </xsl:template>
173
174  <xsl:template match="apirefs">
175    <xsl:message>Generating API Cross References</xsl:message>
176    <xsl:apply-templates select="constructors"/>
177    <xsl:apply-templates select="functions"/>
178    <xsl:apply-templates select="alpha"/>
179    <xsl:apply-templates select="files"/>
180    <xsl:apply-templates select="index"/>
181  </xsl:template>
182
183  <xsl:template match="/">
184    <xsl:message>Executing api.xsl</xsl:message>
185    <xsl:apply-templates select="$apirefs/apirefs"/>
186    <xsl:if test="$dirname=''"> <!-- template for search only for base dir -->
187      <xsl:message>Generating search template</xsl:message>
188      <xsl:variable name="dummydata">
189        <xsl:element name="insert_php">
190          <xsl:value-of select="'Insert point for php code'"/>
191        </xsl:element>
192      </xsl:variable>
193      <xsl:call-template name="new_page">
194        <xsl:with-param name="filename" select="'search.templ'"/>
195        <xsl:with-param name="title" select="'Search engine'"/>
196        <xsl:with-param name="target" select="$dummydata"/>
197      </xsl:call-template>
198    </xsl:if>
199  </xsl:template>
200
201</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.