3 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
5 xmlns:
str=
"http://exslt.org/strings"
6 xmlns:
exsl=
"http://exslt.org/common"
7 xmlns:
date=
"http://exslt.org/dates-and-times"
8 extension-element-prefixes=
"exsl"
9 exclude-result-prefixes=
"str date"
12 <xsl:template name=
"normalizepath">
13 <xsl:param name=
"title"/>
14 <xsl:variable name=
"space-to-underscore" select=
"str:replace($title, ' ', '_')"/>
15 <xsl:variable name=
"open-parens-to-underscore" select=
"str:replace($space-to-underscore, '(', '_')"/>
16 <xsl:value-of select=
"str:replace($open-parens-to-underscore, ')', '_')"/>
19 <xsl:template name=
"linkto">
20 <xsl:param name=
"page"/>
21 <xsl:param name=
"subpage"/>
22 <xsl:param name=
"title"/>
23 <xsl:variable name=
"path">
24 <xsl:call-template name=
"normalizepath">
25 <xsl:with-param name=
"title" select=
"$page"/>
28 <xsl:variable name=
"fragment">
29 <xsl:call-template name=
"normalizepath">
30 <xsl:with-param name=
"title" select=
"$subpage"/>
34 <xsl:when test=
"$fragment=''">
35 <a href=
"{$path}.html"><xsl:value-of select=
"$title"/></a>
37 <xsl:when test=
"$page='' and $fragment!=''">
38 <a href=
"#{$fragment}"><xsl:value-of select=
"$title"/></a>
41 <a href=
"{$path}.html#{$fragment}"><xsl:value-of select=
"$title"/></a>
46 <xsl:template name=
"html5-doctype">
47 <xsl:text disable-output-escaping='yes'
><!DOCTYPE html
></xsl:text>
48 <xsl:call-template name=
"whitespace-newline"/>
51 <xsl:template match=
"*" mode=
"html5-charset">
52 <xsl:text disable-output-escaping='yes'
><meta
charset=
"UTF-8" /
></xsl:text>
53 <xsl:call-template name=
"whitespace-newline"/>
56 <xsl:template name=
"html-no-initial-scaling">
57 <xsl:text disable-output-escaping='yes'
><meta
name=
"viewport" content=
"initial-scale=1"></xsl:text>
58 <xsl:call-template name=
"whitespace-newline"/>
61 <xsl:template name=
"whitespace-newline">
62 <xsl:text> </xsl:text>
65 <xsl:template match=
"title" mode=
"html-head">
66 <xsl:apply-templates select=
"." mode=
"html5-charset"/>
67 <title><xsl:value-of select=
"text()"/> -
<xsl:value-of select=
"/article/section/title"/></title>
68 <link rel=
"stylesheet" type=
"text/css" href=
"default.css"/>
71 <xsl:template match=
"article">
72 <xsl:apply-templates select=
"articleinfo|section"/>
75 <xsl:template match=
"article/section" mode=
"toc">
76 <h1><xsl:apply-templates select=
"title"/></h1>
77 <xsl:apply-templates select=
"document('version.xml')/articleinfo" mode=
"toc"/>
79 <xsl:for-each select=
"section">
81 <xsl:call-template name=
"linkto">
82 <xsl:with-param name=
"title">
83 <xsl:apply-templates select=
"title" mode=
"numbered-level-one"/>
85 <xsl:with-param name=
"page" select=
"title"/>
87 <xsl:if test=
"count(section) > 0">
88 <xsl:call-template name=
"whitespace-newline"/>
90 <xsl:for-each select=
"section">
92 <xsl:call-template name=
"linkto">
93 <xsl:with-param name=
"title">
94 <xsl:apply-templates select=
"title" mode=
"numbered-level-two"/>
96 <xsl:with-param name=
"page" select=
"../title"/>
97 <xsl:with-param name=
"subpage" select=
"title"/>
106 <xsl:apply-templates select=
"section"/>
109 <xsl:template match=
"articleinfo" mode=
"toc">
110 <xsl:apply-templates select=
"abstract"/>
111 <table class=
"c-document_version">
112 <tr><td>Vala version:
</td><td><xsl:apply-templates select=
"edition"/></td></tr>
113 <tr><td>Release:
</td><td><xsl:apply-templates select=
"releaseinfo/text()"/></td></tr>
114 <tr><td>Status:
</td><td><xsl:apply-templates select=
"releaseinfo/remark"/></td></tr>
115 <tr><td>Copyright:
</td>
117 <xsl:text>© </xsl:text>
118 <xsl:apply-templates select=
"copyright/holder"/>
119 <xsl:text> </xsl:text>
120 <xsl:value-of select=
"date:year()"/>
123 <tr><td>License:
</td><td><xsl:apply-templates select=
"legalnotice"/></td></tr>
127 <xsl:template match=
"article/section/section/title" mode=
"heading">
128 <h2><xsl:apply-templates select=
"." mode=
"numbered-level-one"/></h2>
131 <xsl:template match=
"article/section/section/section/title">
132 <xsl:variable name=
"id">
133 <xsl:call-template name=
"normalizepath">
134 <xsl:with-param name=
"title" select=
"."/>
137 <xsl:call-template name=
"whitespace-newline"/>
138 <xsl:call-template name=
"whitespace-newline"/>
139 <h3 id=
"{$id}"><xsl:apply-templates select=
"." mode=
"numbered-level-two"/></h3>
142 <xsl:template match=
"title" mode=
"numbered-level-one">
144 count=
"/article/section/section[ancestor::*]"
145 from=
"/article/section"
149 <xsl:value-of select=
"text()"/>
152 <xsl:template match=
"title" mode=
"numbered-level-two">
154 count=
"article/section/section|article/section/section/section"
158 <xsl:value-of select=
"text()"/>
161 <xsl:template match=
"article/section/section/section/section/title">
162 <xsl:variable name=
"id">
163 <xsl:call-template name=
"normalizepath">
164 <xsl:with-param name=
"title" select=
"."/>
167 <h4><xsl:value-of select=
"."/><a name=
"{$id}"> </a></h4>
170 <xsl:template match=
"article/section/section/section">
171 <xsl:apply-templates select=
"para|section|programlisting|screen|itemizedlist|title|informaltable"/>
174 <xsl:template match=
"article/section/section/section/section">
175 <xsl:apply-templates select=
"para|section|programlisting|screen|itemizedlist|title|informaltable"/>
178 <xsl:template match=
"para">
179 <p><xsl:apply-templates select=
"text()|code|ulink|emphasis"/></p>
182 <xsl:template match=
"emphasis">
183 <strong><xsl:apply-templates select=
"text()"/></strong>
186 <xsl:template match=
"ulink">
187 <xsl:if test=
"starts-with(@url,'https://wiki.gnome.org/Projects/Vala/Manual/Export/Projects/Vala/Manual/')">
188 <xsl:variable name=
"pageid">
189 <xsl:call-template name=
"normalizepath">
190 <xsl:with-param name=
"title" select=
"str:decode-uri(str:tokenize(substring-after(@url, 'https://wiki.gnome.org/Projects/Vala/Manual/Export/Projects/Vala/Manual/'),'#')[1])"/>
193 <a href=
"{$pageid}.html#{str:tokenize(substring-after(@url, 'https://wiki.gnome.org/Projects/Vala/Manual/Export/Projects/Vala/Manual/'),'#')[2]}"><xsl:value-of select=
"."/></a>
195 <xsl:if test=
"not(starts-with(@url,'https://wiki.gnome.org/Projects/Vala/Manual/Export/Projects/Vala/Manual/'))">
196 <a href=
"{@url}"><xsl:value-of select=
"."/></a>
200 <xsl:template match=
"para/code">
201 <xsl:if test=
"contains (text(), '
')">
202 <pre><xsl:value-of select=
"text()"/></pre>
204 <xsl:if test=
"not (contains (text(), '
'))">
205 <code><xsl:value-of select=
"text()"/></code>
209 <xsl:template match=
"screen">
210 <pre><xsl:value-of select=
"text()"/></pre>
213 <!-- program listing -->
214 <xsl:template match=
"programlisting">
215 <pre class=
"o-box c-program"><xsl:apply-templates select=
"text()|type|methodname|token|phrase|lineannotation"/></pre>
218 <xsl:template match=
"type">
219 <span class=
"c-program-type"><xsl:value-of select=
"."/></span>
222 <xsl:template match=
"token">
223 <span class=
"c-program-token"><xsl:value-of select=
"."/></span>
226 <xsl:template match=
"methodname">
227 <span class=
"c-program-methodname"><xsl:value-of select=
"."/></span>
230 <xsl:template match=
"lineannotation">
231 <span class=
"c-program-comment"><xsl:value-of select=
"."/></span>
234 <xsl:template match=
"phrase">
235 <span class=
"c-program-phrase"><xsl:value-of select=
"."/></span>
238 <xsl:template match=
"programlisting/text()[. = ' '][preceding-sibling::*[1][self::phrase]]">
239 <span class=
"c-program-phrase"><xsl:text>\n
</xsl:text></span>
242 <xsl:template match=
"programlisting/text()[. = ' '][preceding-sibling::*[1][self::phrase]]">
243 <span class=
"c-program-phrase"><xsl:text>\n\n
</xsl:text></span>
247 <xsl:template match=
"itemizedlist[listitem[not(@override)]]">
248 <ul><xsl:apply-templates select=
"listitem"/></ul>
251 <xsl:template match=
"listitem[not(@override)]">
252 <li><xsl:apply-templates select=
"para"/></li>
255 <xsl:template match=
"itemizedlist[listitem[@override='none']]">
256 <blockquote class=
"o-box c-rules"><xsl:apply-templates select=
"listitem"/></blockquote>
259 <xsl:template match=
"listitem[@override='none']/itemizedlist"><xsl:apply-templates select=
"listitem"/><xsl:text>
260 </xsl:text></xsl:template>
262 <xsl:template match=
"listitem[@override='none']">
263 <xsl:apply-templates select=
"para|itemizedlist"/>
266 <xsl:template match=
"listitem[@override='none']/para"><xsl:apply-templates select=
"text()|emphasis"/><xsl:text>
267 </xsl:text></xsl:template>
269 <xsl:template match=
"listitem[@override='none']/para/text()">
270 <xsl:if test=
"position()=1 and starts-with(.,' ')">
271 <xsl:if test=
"normalize-space(.)!=''"><xsl:value-of select=
"substring-after(.,' ')"/></xsl:if>
273 <xsl:if test=
"position()!=1 or not(starts-with(.,' '))">
274 <xsl:if test=
"normalize-space(.)!=''"><xsl:value-of select=
"."/></xsl:if>
278 <xsl:template match=
"listitem[@override='none']/para/emphasis[@role='strong']"><span class=
"literal"><xsl:value-of select=
"."/></span></xsl:template>
279 <xsl:template match=
"listitem[@override='none']/itemizedlist/listitem[@override='none']/para"><xsl:text>	</xsl:text><xsl:apply-templates select=
"text()|emphasis"/><xsl:text>
280 </xsl:text></xsl:template>
283 <xsl:template match=
"informaltable">
284 <table class=
"c-informaltable">
285 <xsl:apply-templates select=
"tgroup/tbody/row"/>
289 <xsl:template match=
"row">
291 <xsl:apply-templates select=
"entry"/>
295 <xsl:template match=
"entry">
296 <td xsl:
use-attribute-sets=
"entry-attrs">
297 <xsl:apply-templates select=
"para"/>
301 <xsl:attribute-set name=
"entry-attrs">
302 <xsl:attribute name=
"align"><xsl:value-of select=
"@align"/></xsl:attribute>
303 <xsl:attribute name=
"colspan">
304 <xsl:if test=
"@nameend"><xsl:value-of select=
"number(substring-after(@nameend, 'col_'))+1"/></xsl:if>