1 <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:exsl="http://exslt.org/common"
5 extension-element-prefixes="exsl" version="1.0">
7 <xsl:variable name="controlCharacter" select="'¤'" />
8 <xsl:variable name="crlf" select="' '" />
9 <!-- <xsl:variable name="wikistyle" select="false()" /> -->
11 <xsl:variable name="supportMenu" select="'true'" />
12 <xsl:variable name="supportShowme" select="'true'" />
13 <xsl:variable name="supportSource" select="'true'" />
14 <xsl:variable name="supportImage" select="'true'" />
16 <xsl:template name="findNext">
17 <xsl:param name="content" />
18 <xsl:variable name="escaped" select="substring-after( $content, '\{' )" />
19 <xsl:variable name="item-start" select="substring-after( $content, '{' )" />
20 <xsl:variable name="item-end" select="substring-before( $item-start, '}' )" />
21 <xsl:if test="normalize-space($escaped) != normalize-space($item-start)">
22 <xsl:copy-of select="normalize-space($item-end)" />
26 <xsl:template name="findNextTag">
27 <xsl:param name="content" />
28 <xsl:variable name="item-start" select="substring-after( $content, '|' )" />
29 <xsl:variable name="item-end" select="substring-before( $item-start, '|' )" />
30 <xsl:variable name="name-start" select="substring-after( $item-start, '(' )" />
31 <xsl:variable name="name-end" select="substring-before( $name-start, ')' )" />
32 <!-- <xsl:copy-of select="normalize-space($item-end)" /> -->
33 <xsl:variable name="w" select="substring-after( $item-end, ') ')" />
34 <xsl:if test="string($w)">
35 <xsl:element name="{$w}">
36 <xsl:value-of select="$name-end" />
41 <xsl:template name="lastCall">
42 <xsl:param name="content" />
44 <xsl:variable name="inTheBeginning" select="substring-before( $content, '|' )" />
45 <xsl:variable name="markup-start" select="substring-after( $content, '|' )" />
46 <xsl:variable name="markup-end" select="substring-before( $markup-start, '|' )" />
47 <xsl:variable name="markup-after" select="substring-after( $markup-start, concat( $markup-end, '|') )" />
49 <xsl:variable name="cmd" select="substring-before( $markup-end, ';' )" />
51 <xsl:copy-of select="$inTheBeginning" />
54 <xsl:when test="string($markup-end)">
56 <xsl:when test="starts-with( $markup-end, '!' )">
57 <span class="note"><xsl:copy-of select="substring-after( $markup-end, '!')" /></span>
59 <xsl:when test="starts-with( $markup-end, '/' )">
60 <em><xsl:copy-of select="substring-after( $markup-end, '/')" /></em>
62 <xsl:when test="starts-with( $markup-end, '*' )">
63 <pre><xsl:copy-of select="substring-after( $markup-end, '*')" /></pre>
66 <strong><xsl:copy-of select="$markup-end" /></strong>
69 <xsl:call-template name="lastCall">
70 <xsl:with-param name="content" select="$markup-after" />
72 <!-- [<xsl:copy-of select="$markup-after" />] -->
75 <xsl:copy-of select="$content" />
81 <xsl:template name="replace-tags">
82 <xsl:param name="content" />
83 <xsl:param name="currentID" />
84 <xsl:variable name="topic"><xsl:call-template name="findNext"><xsl:with-param name="content" select="$content" /></xsl:call-template></xsl:variable>
85 <!-- <xsl:variable name="this" select="$thisDoc/item[@id=$topic]" /> -->
86 <!-- <xsl:variable name="name" select="$this/@name" /> -->
87 <xsl:variable name="name"><xsl:call-template name="getTopicName"><xsl:with-param name="id" select="$topic" /></xsl:call-template></xsl:variable>
89 <xsl:variable name="escaped-start" select="substring-after( $content, '\{' )" />
90 <xsl:variable name="item-start" select="substring-before( $content, '{' )" />
92 <xsl:variable name="item-end" select="substring-after( $content, '}' )" />
93 <xsl:variable name="escaped-end" select="substring-after( $content, '\}' )" />
95 <xsl:if test="string(normalize-space($item-start))">
96 <xsl:if test="normalize-space($escaped-start) != normalize-space($item-start)">
97 <xsl:call-template name="lastCall">
98 <xsl:with-param name="content" select="$item-start" />
101 <xsl:if test="normalize-space($escaped-start) = normalize-space($item-start)">
102 <xsl:call-template name="lastCall">
103 <xsl:with-param name="content" select="$escaped-start" />
108 <xsl:variable name="middle">
109 <xsl:if test="string(normalize-space($topic))">
111 <!-- <xsl:value-of select="$topic" />(<xsl:value-of select="substring($topic, 1)" />) -->
113 <xsl:when test="substring($topic, 1, 1) = '('">
115 <xsl:variable name="tmp"><xsl:value-of select="substring-before( $topic, ')' )" /></xsl:variable>
116 <xsl:variable name="thisName" select="substring-after( $topic, ') ' )" />
117 <xsl:variable name="name2">
119 <xsl:when test="substring($topic, 2, 1) = '%'"><img src="{substring( $tmp, 3 )}" class="image" border="0" alt="" /></xsl:when>
120 <xsl:otherwise><xsl:value-of select="substring( $tmp, 2 )" /></xsl:otherwise>
124 <xsl:when test="starts-with($thisName, 'http')">
125 <xsl:element name="a">
126 <xsl:attribute name="href"><xsl:value-of select="$thisName" /></xsl:attribute>
127 <xsl:if test="substring($topic, 2, 1) != '%'">
128 <xsl:attribute name="class">extLink</xsl:attribute>
129 </xsl:if><xsl:copy-of select="$name2" />
132 <xsl:when test="starts-with($thisName, 'mailto')">
133 <xsl:element name="a">
134 <xsl:attribute name="href"><xsl:value-of select="$thisName" /></xsl:attribute>
135 <xsl:if test="substring($topic, 2, 1) != '%'">
136 <xsl:attribute name="class">extLink</xsl:attribute>
137 </xsl:if><xsl:copy-of select="$name2" />
141 <xsl:element name="a">
142 <xsl:attribute name="href"><xsl:value-of select="$thisName" />.html</xsl:attribute>
143 <xsl:if test="not(substring($topic, 2, 1) = '%')">
144 <xsl:attribute name="class">topicLink</xsl:attribute>
146 <xsl:copy-of select="$name2" />
152 <xsl:when test="substring($topic, 1, 1) = '!' and string($supportMenu)">
153 <menu style="{substring-after($topic, '!')}"/>
155 <xsl:when test="substring($topic, 1, 1) = '#' and string($supportShowme)">
156 <show-me what="{substring-after($topic, '#')}" id="{$currentID}" />
158 <xsl:when test="substring($topic, 1, 1) = '+' and string($supportSource)">
159 <div class="viewSource"><a href="content/{$currentID}.orig" class="viewSource">view content source file</a></div>
161 <xsl:when test="substring($topic, 1, 1) = '%' and string($supportImage)">
162 <image href="{substring-after($topic, '%')}" id="{$currentID}" />
164 <xsl:when test="starts-with($topic, 'http')">
165 <xsl:element name="a">
166 <xsl:attribute name="href"><xsl:value-of select="$topic" /></xsl:attribute>
167 <xsl:attribute name="class">extLink</xsl:attribute><xsl:value-of select="$topic" />
171 <xsl:element name="a">
172 <xsl:attribute name="href"><xsl:value-of select="$topic" />.html</xsl:attribute>
173 <xsl:attribute name="class">topicLink</xsl:attribute><xsl:value-of select="$name" />
181 <xsl:call-template name="lastCall">
182 <xsl:with-param name="content" select="$middle" />
184 <!-- <xsl:copy-of select="$middle" />
186 <xsl:variable name="more">
187 <xsl:call-template name="findNext">
188 <xsl:with-param name="content" select="$item-end" />
193 <xsl:when test="string(normalize-space($more))">
194 <xsl:call-template name="replace-tags"><xsl:with-param name="content" select="$item-end" /><xsl:with-param name="currentID" select="$currentID" /></xsl:call-template>
197 <xsl:if test="string(normalize-space($item-end))">
198 <xsl:call-template name="lastCall">
199 <xsl:with-param name="content" select="$item-end" />
201 <!-- <xsl:copy-of select="$item-end" />
206 <xsl:if test="not(string(normalize-space($item-start))) and not(string(normalize-space($item-end))) and not(string(normalize-space($topic)))">
207 <xsl:call-template name="lastCall">
208 <xsl:with-param name="content" select="$content" />
210 <!-- <xsl:copy-of select="$content" /> -->
215 <xsl:template name="markupLine">
216 <xsl:param name="content" />
217 <xsl:param name="currentID" />
218 <xsl:variable name="first" select="substring($content, 1, 1)" />
219 <xsl:variable name="c">
220 <xsl:if test="$wikistyle">
221 <xsl:if test="string($first) = '?'">question</xsl:if>
222 <xsl:if test="string($first) = '='">answer</xsl:if>
223 <xsl:if test="string($first) = '!'">note</xsl:if>
224 <xsl:if test="string($first) = '*'">point</xsl:if>
225 <xsl:if test="string($first) = '.'">indent</xsl:if>
226 <xsl:if test="string($first) = '|'">code</xsl:if>
227 <xsl:if test="string($first) = ':'">blank</xsl:if>
228 <xsl:if test="string($first) = '-'">headerSmall</xsl:if>
229 <xsl:if test="string($first) = '+'">headerLarge</xsl:if>
230 <xsl:if test="string($first) = '#'">meta</xsl:if>
232 <xsl:if test="not($wikistyle)"></xsl:if>
236 <xsl:text>c: </xsl:text><xsl:value-of select="$c"/>
237 <xsl:text> wikistyle: </xsl:text><xsl:value-of select="$wikistyle"/>
240 <xsl:variable name="cont">
241 <xsl:if test="string($c) and $wikistyle">
242 <xsl:copy-of select="substring($content, 2)" /></xsl:if>
243 <xsl:if test="not(string($c))">
244 <xsl:copy-of select="$content" /></xsl:if>
247 <xsl:variable name="class">
248 <xsl:if test="string($c)">
249 <xsl:copy-of select="$c" /></xsl:if>
250 <xsl:if test="not(string($c))">normal</xsl:if>
254 <xsl:when test="$c = 'meta'">
255 <xsl:variable name="what" select="$cont" />
256 <xsl:variable name="before" select="substring-before($what, '=')" />
257 <xsl:variable name="after" select="substring-after($what, '=')" />
258 <xsl:if test="string($before)">
259 <xsl:text disable-output-escaping="yes"><![CDATA[<]]></xsl:text><xsl:copy-of select="normalize-space($before)" /><xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
260 <xsl:copy-of select="$after" />
261 <xsl:text disable-output-escaping="yes"><![CDATA[</]]></xsl:text><xsl:copy-of select="normalize-space($before)" /><xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
264 <xsl:when test="$c = 'code'">
265 <p class="{$class}"><xsl:copy-of select="$cont" /></p>
267 <xsl:when test="not($wikistyle)">
268 <p class="{$class}"><xsl:copy-of select="$cont" /></p>
269 <!-- <xsl:message terminate="yes" /> -->
272 <p class="{$class}"><xsl:call-template name="replace-tags"><xsl:with-param name="content" select="$cont" /><xsl:with-param name="currentID" select="$currentID" /></xsl:call-template></p>
277 <xsl:template name="doLine">
278 <xsl:param name="content" />
279 <xsl:param name="currentID" />
280 <xsl:variable name="line" select="normalize-space(concat( substring-before( $content, $controlCharacter ), $controlCharacter))" />
281 <xsl:variable name="lineClear" select="normalize-space(translate( $line, $controlCharacter, ' ' ))" />
282 <xsl:variable name="next" select="normalize-space(substring-after( $content, $line ))" />
283 <!-- [<xsl:value-of select="$content" />]<br/>
284 [<xsl:value-of select="$line" />]<br/>
285 [<xsl:value-of select="$lineClear" />]<br/>
286 [<xsl:value-of select="$next" />]<br/> -->
287 <xsl:if test="string(normalize-space($lineClear))">
288 <xsl:call-template name="markupLine"><xsl:with-param name="content"><xsl:copy-of select="$lineClear" /></xsl:with-param><xsl:with-param name="currentID" select="$currentID" /></xsl:call-template>
290 <xsl:if test="string(normalize-space($next))">
291 <xsl:call-template name="doLine"><xsl:with-param name="content"><xsl:copy-of select="$next" /></xsl:with-param><xsl:with-param name="currentID" select="$currentID" /></xsl:call-template>