source: rfc2629xslt/gen-w3c-reference.xslt

Last change on this file was 2750, checked in by julian.reschke@…, 7 years ago

update rfc2629.xslt

  • Property svn:executable set to *
File size: 21.3 KB
Line 
1<!--
2    Generate W3C references based on the W3C publication database
3    <http://www.w3.org/2002/01/tr-automation/tr.rdf>)
4
5    Copyright (c) 2010-2016, Julian Reschke (julian.reschke@greenbytes.de)
6    All rights reserved.
7
8    Redistribution and use in source and binary forms, with or without
9    modification, are permitted provided that the following conditions are met:
10
11    * Redistributions of source code must retain the above copyright notice,
12      this list of conditions and the following disclaimer.
13    * Redistributions in binary form must reproduce the above copyright notice,
14      this list of conditions and the following disclaimer in the documentation
15      and/or other materials provided with the distribution.
16    * Neither the name of Julian Reschke nor the names of its contributors
17      may be used to endorse or promote products derived from this software
18      without specific prior written permission.
19
20    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30    POSSIBILITY OF SUCH DAMAGE.
31-->
32
33<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
34               xmlns:contact="http://www.w3.org/2000/10/swap/pim/contact#"
35               xmlns:dc="http://purl.org/dc/elements/1.1/"
36               xmlns:doc="http://www.w3.org/2000/10/swap/pim/doc#"
37               xmlns:org="http://www.w3.org/2001/04/roadmap/org#"
38               xmlns:r="http://www.w3.org/2001/02pd/rec54#"
39               xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
40               xmlns:x="http://purl.org/net/xml2rfc/ext"
41               version="1.0"
42               exclude-result-prefixes="contact dc doc org r rdf"
43>
44
45<xsl:output encoding="US-ASCII" omit-xml-declaration="yes" indent="yes"/>
46
47<xsl:param name="shortname"/>
48<xsl:param name="anchor"/>
49
50<xsl:template match="/">
51  <xsl:choose>
52    <xsl:when test="$shortname!=''">
53      <xsl:variable name="f" select="//*[contains(@rdf:about,concat('/',$shortname))]"/>
54      <xsl:choose>
55        <xsl:when test="count($f)=0">
56          <xsl:message terminate="yes">shortname not found in publication database</xsl:message>
57        </xsl:when>
58        <xsl:when test="count($f)>1">
59          <xsl:message terminate="yes">ambiguous match for shortname</xsl:message>
60        </xsl:when>
61        <xsl:otherwise>
62          <xsl:for-each select="$f">
63            <xsl:call-template name="genref"/>
64          </xsl:for-each>
65        </xsl:otherwise>
66      </xsl:choose>
67    </xsl:when>
68    <xsl:otherwise>
69      <xsl:processing-instruction name="rfc">private='W3C References'</xsl:processing-instruction>
70      <xsl:processing-instruction name="rfc">sortrefs='yes'</xsl:processing-instruction>
71      <xsl:processing-instruction name="rfc">symrefs='yes'</xsl:processing-instruction>
72      <xsl:processing-instruction name="rfc-ext">allow-markup-in-artwork='yes'</xsl:processing-instruction>
73      <xsl:processing-instruction name="rfc-ext">include-references-in-index='yes'</xsl:processing-instruction>
74      <xsl:processing-instruction name="rfc-ext">check-artwork-width='no'</xsl:processing-instruction>
75      <xsl:processing-instruction name="rfc-ext">html-pretty-print="prettyprint https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"</xsl:processing-instruction>
76      <rfc>
77        <front>
78          <title abbrev="xml2rfc refs for W3C specs">Xml2Rfc References For W3C Specifications</title>   
79          <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor">
80            <organization abbrev="greenbytes">greenbytes GmbH</organization>
81            <address>
82              <postal>
83                <street>Hafenweg 16</street>
84                <city>Muenster</city><region>NW</region><code>48155</code>
85                <country>Germany</country>
86              </postal>
87              <phone>+49 251 2807760</phone>
88              <email>julian.reschke@greenbytes.de</email>
89              <uri>http://greenbytes.de/tech/webdav/</uri>
90            </address>
91          </author>
92          <date/>
93       </front>
94        <middle>
95          <section title="Introduction">
96            <t>
97              Automatically generated from <eref target="http://www.w3.org/2002/01/tr-automation/tr.rdf"/> using
98              <eref target="http://greenbytes.de/tech/webdav/rfc2629xslt/gen-w3c-reference.xslt"/>.
99            </t>
100            <t>
101              Note that the ordering of authors is determined by retrieving the
102              spec text and checking for the first occurance of the full author name.
103              This may sometimes fail. If you find incorrect orderings, please
104              notify <eref target="mailto:julian.reschke@gmx.de?subject=W3C%20author%20ordering">julian.reschke@gmx.de</eref>.
105            </t>
106          </section>
107          <section title="&lt;reference> elements">
108            <xsl:for-each select="/*/*[not(self::r:ActivityStatement or self::rdf:Description)]">
109              <xsl:sort select="substring-after(substring-after(substring-after(substring-after(@rdf:about,'//'),'/'),'/'),'/')"/>
110              <xsl:call-template name="genref-figures"/>
111            </xsl:for-each>
112          </section>
113        </middle>
114        <back>
115          <references>
116            <xsl:for-each select="/*/*[not(self::r:ActivityStatement or self::rdf:Description)]">
117              <xsl:call-template name="genref"/>
118            </xsl:for-each>
119          </references>
120        </back>
121      </rfc>
122    </xsl:otherwise>
123  </xsl:choose>
124</xsl:template>
125
126<xsl:template name="basename">
127  <xsl:param name="s"/>
128  <xsl:choose>
129    <xsl:when test="contains($s,'/') and substring-after($s,'/')!=''">
130      <xsl:call-template name="basename">
131        <xsl:with-param name="s" select="substring-after($s,'/')"/>
132      </xsl:call-template>
133    </xsl:when>
134    <xsl:otherwise>
135      <xsl:value-of select="translate($s,'/','')"/>
136    </xsl:otherwise>
137  </xsl:choose>
138</xsl:template>
139
140<xsl:template name="genref">
141  <xsl:variable name="s">
142    <xsl:call-template name="basename">
143      <xsl:with-param name="s" select="@rdf:about"/>
144    </xsl:call-template>
145  </xsl:variable>
146 
147  <!-- exclude a few broken ones -->
148  <xsl:if test="string-length(translate(substring($s,1,1),'0123456789',''))!=0">
149    <reference target="{@rdf:about}">
150      <xsl:attribute name="anchor">
151        <xsl:choose>
152          <xsl:when test="$shortname!=''">
153            <xsl:value-of select="$shortname"/>
154          </xsl:when>
155          <xsl:otherwise>
156            <xsl:value-of select="$s"/>
157          </xsl:otherwise>
158        </xsl:choose>
159      </xsl:attribute>
160      <front>
161        <title><xsl:value-of select="dc:title"/></title>
162        <xsl:apply-templates select="r:editor/contact:fullName|r:editor/org:name"/>
163        <xsl:if test="count(r:editor/contact:fullName|r:editor/org:name)=0">
164          <xsl:message>No author information for <xsl:value-of select="$s"/></xsl:message>
165          <author>
166            <xsl:comment>author info missing</xsl:comment>
167            <organization/>
168          </author>
169        </xsl:if>
170        <date>
171          <xsl:variable name="yyyy" select="substring-before(dc:date,'-')"/>
172          <xsl:variable name="mmdd" select="substring-after(dc:date,'-')"/>
173          <xsl:variable name="mm" select="substring-before($mmdd,'-')"/>
174          <xsl:variable name="dd" select="substring-after($mmdd,'-')"/>
175          <xsl:attribute name="year">
176            <xsl:value-of select="$yyyy"/>
177          </xsl:attribute>
178          <xsl:attribute name="month">
179            <xsl:call-template name="getmonth"><xsl:with-param name="mm" select="$mm"/></xsl:call-template>
180          </xsl:attribute>
181          <xsl:attribute name="day">
182            <xsl:value-of select="$dd"/>
183          </xsl:attribute>
184        </date>
185      </front>
186      <seriesInfo>
187        <xsl:attribute name="name">
188          <xsl:call-template name="getseries">
189            <xsl:with-param name="s" select="$s"/>
190          </xsl:call-template>
191        </xsl:attribute>
192        <xsl:attribute name="value">
193          <xsl:value-of select="$s"/>
194        </xsl:attribute>
195      </seriesInfo>
196      <xsl:if test="doc:versionOf">
197        <annotation>Latest version available at <eref target="{doc:versionOf/@rdf:resource}"/>.</annotation>
198      </xsl:if>
199    </reference>
200  </xsl:if>
201 
202</xsl:template>
203
204<xsl:template name="genref-figures">
205  <xsl:variable name="s">
206    <xsl:call-template name="basename">
207      <xsl:with-param name="s" select="@rdf:about"/>
208    </xsl:call-template>
209  </xsl:variable>
210 
211  <!-- exclude a few broken ones -->
212  <xsl:if test="string-length(translate(substring($s,1,1),'0123456789',''))!=0">
213    <xsl:variable name="link">
214      <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="@rdf:about"/></xsl:call-template>
215    </xsl:variable>
216    <xsl:variable name="anchor">
217      <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="$s"/></xsl:call-template>
218    </xsl:variable>
219    <xsl:variable name="latest">
220      <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="doc:versionOf/@rdf:resource"/></xsl:call-template>
221    </xsl:variable>
222    <xsl:variable name="tseries">
223      <xsl:call-template name="getseries">
224        <xsl:with-param name="s" select="$s"/>
225      </xsl:call-template>
226    </xsl:variable>
227    <xsl:variable name="series">
228      <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="$tseries"/></xsl:call-template>
229    </xsl:variable>
230    <xsl:variable name="yyyy" select="substring-before(dc:date,'-')"/>
231    <xsl:variable name="mmdd" select="substring-after(dc:date,'-')"/>
232    <xsl:variable name="mm" select="substring-before($mmdd,'-')"/>
233    <xsl:variable name="dd" select="substring-after($mmdd,'-')"/>
234    <xsl:variable name="month">
235      <xsl:call-template name="getmonth"><xsl:with-param name="mm" select="$mm"/></xsl:call-template>
236    </xsl:variable>
237    <xsl:variable name="title">
238      <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="dc:title"/></xsl:call-template>
239    </xsl:variable>
240   
241    <section title="{$s}: {dc:title}" anchor="ref-{$anchor}">
242      <iref item="{$tseries}" subitem="{$s}"/>
243      <xsl:apply-templates select="r:editor/contact:fullName" mode="iref">
244        <xsl:with-param name="s" select="$s"/>
245      </xsl:apply-templates>
246      <t>
247        Reference element for <xref target="{$s}"/>.
248      </t>
249<figure><artwork type="inline" x:lang="">
250&lt;reference anchor='<xsl:value-of select="$anchor"/>'
251           target='<xsl:value-of select="$link"/>'>
252  &lt;front>
253    &lt;title><xsl:value-of select="$title"/>&lt;/title>
254<xsl:apply-templates select="r:editor/contact:fullName|r:editor/org:name" mode="figure"/>    &lt;date year='<xsl:value-of select="$yyyy"/>' month='<xsl:value-of select="$month"/>' day='<xsl:value-of select="$dd"/>'/>
255  &lt;/front>
256  &lt;seriesInfo name='<xsl:value-of select="$series"/>' value='<xsl:value-of select="$anchor"/>'/>
257<xsl:if test="doc:versionOf">  &lt;annotation>
258    Latest version available at
259    &lt;eref target='<xsl:value-of select="$latest"/>'/>.
260  &lt;/annotation>
261</xsl:if>&lt;/reference>
262</artwork></figure>     
263      <xsl:if test="processing-instruction('sort-rdf')='alpha'">
264        <t>
265          <spanx>The ordering of author names above may be incorrect.</spanx>
266        </t>
267      </xsl:if>
268    </section>
269  </xsl:if>
270 
271</xsl:template>
272
273<xsl:template match="contact:fullName">
274  <xsl:variable name="surname">
275    <xsl:call-template name="getsurname">
276      <xsl:with-param name="s" select="normalize-space(.)"/>
277    </xsl:call-template>
278  </xsl:variable>
279  <xsl:variable name="givenname" select="normalize-space(substring-before(normalize-space(.),$surname))"/>
280  <xsl:variable name="initials">
281    <xsl:call-template name="getinitials">
282      <xsl:with-param name="s" select="$givenname"/>
283    </xsl:call-template>
284  </xsl:variable>
285 
286  <xsl:variable name="allowed">ABCDEFGHIJHKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.() -'0123456789</xsl:variable>
287 
288  <xsl:variable name="tmp" select="."/>
289  <xsl:variable name="mapped" select="$map/map/entry[@key=$tmp]"/>
290  <xsl:variable name="fn">
291    <xsl:choose>
292      <xsl:when test="$mapped"><xsl:value-of select="$mapped/@fn"/></xsl:when>
293      <xsl:otherwise><xsl:value-of select="$tmp"/></xsl:otherwise>
294    </xsl:choose>
295  </xsl:variable>
296  <xsl:variable name="sn">
297    <xsl:choose>
298      <xsl:when test="$mapped"><xsl:value-of select="$mapped/@surname"/></xsl:when>
299      <xsl:otherwise><xsl:value-of select="$surname"/></xsl:otherwise>
300    </xsl:choose>
301  </xsl:variable>
302  <xsl:variable name="i">
303    <xsl:choose>
304      <xsl:when test="$mapped"><xsl:value-of select="$mapped/@initials"/></xsl:when>
305      <xsl:otherwise><xsl:value-of select="$initials"/></xsl:otherwise>
306    </xsl:choose>
307  </xsl:variable>
308
309  <xsl:if test="translate($fn,$allowed,'')!=''">
310    <xsl:message>WARNING: non-ASCII characters in <xsl:value-of select="$fn"/>: <xsl:value-of select="translate($fn,$allowed,'')"/></xsl:message>
311  </xsl:if>
312  <xsl:if test="translate($sn,$allowed,'')!=''">
313    <xsl:message>WARNING: non-ASCII characters in <xsl:value-of select="$sn"/>: <xsl:value-of select="translate($sn,$allowed,'')"/></xsl:message>
314  </xsl:if>
315  <xsl:if test="translate($i,$allowed,'')!=''">
316    <xsl:message>WARNING: non-ASCII characters in <xsl:value-of select="$i"/>: <xsl:value-of select="translate($i,$allowed,'')"/></xsl:message>
317  </xsl:if>
318 
319  <author fullname="{$fn}" surname="{$sn}" initials="{normalize-space($i)}" />
320</xsl:template>
321
322<xsl:template match="contact:fullName" mode="iref">
323  <xsl:param name="s"/>
324  <xsl:variable name="surname">
325    <xsl:call-template name="getsurname">
326      <xsl:with-param name="s" select="normalize-space(.)"/>
327    </xsl:call-template>
328  </xsl:variable>
329  <xsl:variable name="givenname" select="normalize-space(substring-before(normalize-space(.),$surname))"/>
330  <xsl:variable name="initials">
331    <xsl:call-template name="getinitials">
332      <xsl:with-param name="s" select="$givenname"/>
333    </xsl:call-template>
334  </xsl:variable>
335  <iref subitem="{$s}">
336    <xsl:attribute name="item">
337      <xsl:call-template name="filter"><xsl:with-param name="s" select="normalize-space($surname)"/></xsl:call-template>
338      <xsl:text>, </xsl:text>
339      <xsl:call-template name="filter"><xsl:with-param name="s" select="normalize-space($initials)"/></xsl:call-template>
340    </xsl:attribute>
341  </iref>
342</xsl:template>
343
344<xsl:template match="contact:fullName" mode="figure">
345  <xsl:variable name="surname">
346    <xsl:call-template name="getsurname">
347      <xsl:with-param name="s" select="normalize-space(.)"/>
348    </xsl:call-template>
349  </xsl:variable>
350  <xsl:variable name="givenname" select="normalize-space(substring-before(normalize-space(.),$surname))"/>
351  <xsl:variable name="initials">
352    <xsl:call-template name="getinitials">
353      <xsl:with-param name="s" select="$givenname"/>
354    </xsl:call-template>
355  </xsl:variable>
356  <xsl:variable name="tmp" select="."/>
357  <xsl:variable name="mapped" select="$map/map/entry[@key=$tmp]"/>
358  <xsl:variable name="fn">
359    <xsl:choose>
360      <xsl:when test="$mapped"><xsl:value-of select="$mapped/@fn"/></xsl:when>
361      <xsl:otherwise><xsl:value-of select="$tmp"/></xsl:otherwise>
362    </xsl:choose>
363  </xsl:variable>
364  <xsl:variable name="sn">
365    <xsl:choose>
366      <xsl:when test="$mapped"><xsl:value-of select="$mapped/@surname"/></xsl:when>
367      <xsl:otherwise><xsl:value-of select="$surname"/></xsl:otherwise>
368    </xsl:choose>
369  </xsl:variable>
370  <xsl:variable name="i">
371    <xsl:choose>
372      <xsl:when test="$mapped"><xsl:value-of select="$mapped/@initials"/></xsl:when>
373      <xsl:otherwise><xsl:value-of select="$initials"/></xsl:otherwise>
374    </xsl:choose>
375  </xsl:variable>
376
377  <xsl:text>    &lt;author fullname='</xsl:text>
378  <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="$fn"/></xsl:call-template>
379  <xsl:text>' surname='</xsl:text>
380  <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="$sn"/></xsl:call-template>
381  <xsl:text>' initials='</xsl:text>
382  <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="$i"/></xsl:call-template>
383  <xsl:text>'/>&#10;</xsl:text>
384</xsl:template>
385
386<xsl:template match="org:name">
387  <author>
388    <organization><xsl:value-of select="."/></organization>
389  </author>
390</xsl:template>
391
392<xsl:template match="org:name" mode="figure">
393  <xsl:text>    &lt;author>&#10;</xsl:text>
394  <xsl:text>      &lt;organization></xsl:text>
395  <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="."/></xsl:call-template>
396  <xsl:text>&lt;/organization>&#10;</xsl:text>
397  <xsl:text>    &lt;/author>&#10;</xsl:text>
398</xsl:template>
399
400<xsl:variable name="editors" select="document('known-tr-editors.rdf')"/>
401<xsl:variable name="map" select="document('w3c-author-map.xml')"/>
402
403<xsl:template name="getseries">
404  <xsl:param name="s"/>
405  <xsl:choose>
406    <xsl:when test="starts-with($s,'CR-')">W3C Candidate Recommendation</xsl:when>
407    <xsl:when test="starts-with($s,'NOTE-')">W3C Group Note</xsl:when>
408    <xsl:when test="starts-with($s,'PER-')">W3C Proposed Edited Recommendation</xsl:when>
409    <xsl:when test="starts-with($s,'PR-')">W3C Proposed Recommendation</xsl:when>
410    <xsl:when test="starts-with($s,'REC-')">W3C Recommendation</xsl:when>
411    <xsl:when test="starts-with($s,'WD-')">W3C Working Draft</xsl:when>
412    <xsl:otherwise>W3C ???</xsl:otherwise>
413  </xsl:choose>
414</xsl:template>
415
416<xsl:template name="getmonth">
417  <xsl:param name="mm"/>
418  <xsl:choose> 
419    <xsl:when test="$mm=1">January</xsl:when>
420    <xsl:when test="$mm=2">February</xsl:when>
421    <xsl:when test="$mm=3">March</xsl:when>
422    <xsl:when test="$mm=4">April</xsl:when>
423    <xsl:when test="$mm=5">May</xsl:when>
424    <xsl:when test="$mm=6">June</xsl:when>
425    <xsl:when test="$mm=7">July</xsl:when>
426    <xsl:when test="$mm=8">August</xsl:when>
427    <xsl:when test="$mm=9">September</xsl:when>
428    <xsl:when test="$mm=10">October</xsl:when>
429    <xsl:when test="$mm=11">November</xsl:when>
430    <xsl:when test="$mm=12">December</xsl:when>
431  </xsl:choose>
432</xsl:template>
433
434<xsl:template name="getsurname">
435  <xsl:param name="s"/>
436  <xsl:choose>
437    <xsl:when test="$editors//contact:lastName=$s">
438      <xsl:value-of select="$s"/>
439    </xsl:when>
440    <xsl:when test="contains($s,' ')">
441      <xsl:call-template name="getsurname">
442        <xsl:with-param name="s" select="substring-after($s,' ')"/>
443      </xsl:call-template>
444    </xsl:when>
445    <xsl:otherwise>
446      <xsl:value-of select="$s"/>
447    </xsl:otherwise>
448  </xsl:choose>
449</xsl:template>
450
451<xsl:template name="getinitials">
452  <xsl:param name="s"/>
453  <xsl:choose>
454    <xsl:when test="contains($s,' ')">
455      <xsl:value-of select="substring($s,1,1)"/><xsl:text>. </xsl:text>
456      <xsl:call-template name="getinitials">
457        <xsl:with-param name="s" select="substring-after($s,' ')"/>
458      </xsl:call-template>
459    </xsl:when>
460    <xsl:otherwise>
461      <xsl:value-of select="substring($s,1,1)"/><xsl:text>.</xsl:text>
462    </xsl:otherwise>
463  </xsl:choose>
464</xsl:template>
465
466<xsl:template name="escapefilter">
467  <xsl:param name="s"/>
468  <xsl:choose>
469    <xsl:when test="$s!=''">
470      <xsl:variable name="apos">'</xsl:variable>
471      <xsl:variable name="l" select="substring($s,1,1)"/>
472      <xsl:choose>
473        <xsl:when test="$l='&amp;'">
474          <xsl:text>&amp;amp;</xsl:text>
475        </xsl:when>
476        <xsl:when test="$l='&quot;'">
477          <xsl:text>&amp;quot;</xsl:text>
478        </xsl:when>
479        <xsl:when test="$l=$apos">
480          <xsl:text>&amp;apos;</xsl:text>
481        </xsl:when>
482        <xsl:when test="$l='&#8482;'">
483          <xsl:text>(tm)</xsl:text>
484        </xsl:when>
485        <xsl:otherwise>
486          <xsl:value-of select="$l"/>
487        </xsl:otherwise>
488      </xsl:choose>
489      <xsl:call-template name="escapefilter">
490        <xsl:with-param name="s" select="substring($s,2)"/>
491      </xsl:call-template>
492    </xsl:when>
493    <xsl:otherwise/>
494  </xsl:choose>
495</xsl:template>
496
497<xsl:template name="filter">
498  <xsl:param name="s"/>
499  <xsl:choose>
500    <xsl:when test="$s!=''">
501      <xsl:variable name="l" select="substring($s,1,1)"/>
502      <xsl:choose>
503        <xsl:when test="$l='&#8482;'">
504          <xsl:text>(tm)</xsl:text>
505        </xsl:when>
506        <xsl:otherwise>
507          <xsl:value-of select="$l"/>
508        </xsl:otherwise>
509      </xsl:choose>
510      <xsl:call-template name="filter">
511        <xsl:with-param name="s" select="substring($s,2)"/>
512      </xsl:call-template>
513    </xsl:when>
514    <xsl:otherwise/>
515  </xsl:choose>
516</xsl:template>
517
518</xsl:transform>
Note: See TracBrowser for help on using the repository browser.