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-2012, 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 | version="1.0" |
---|
41 | exclude-result-prefixes="contact dc doc org r rdf" |
---|
42 | > |
---|
43 | |
---|
44 | <xsl:output encoding="US-ASCII" omit-xml-declaration="yes" indent="yes"/> |
---|
45 | |
---|
46 | <xsl:param name="shortname"/> |
---|
47 | <xsl:param name="anchor"/> |
---|
48 | |
---|
49 | <xsl:template match="/"> |
---|
50 | <xsl:choose> |
---|
51 | <xsl:when test="$shortname!=''"> |
---|
52 | <xsl:variable name="f" select="//*[contains(@rdf:about,concat('/',$shortname))]"/> |
---|
53 | <xsl:choose> |
---|
54 | <xsl:when test="count($f)=0"> |
---|
55 | <xsl:message terminate="yes">shortname not found in publication database</xsl:message> |
---|
56 | </xsl:when> |
---|
57 | <xsl:when test="count($f)>1"> |
---|
58 | <xsl:message terminate="yes">ambiguous match for shortname</xsl:message> |
---|
59 | </xsl:when> |
---|
60 | <xsl:otherwise> |
---|
61 | <xsl:for-each select="$f"> |
---|
62 | <xsl:call-template name="genref"/> |
---|
63 | </xsl:for-each> |
---|
64 | </xsl:otherwise> |
---|
65 | </xsl:choose> |
---|
66 | </xsl:when> |
---|
67 | <xsl:otherwise> |
---|
68 | <xsl:processing-instruction name="rfc">private='W3C References'</xsl:processing-instruction> |
---|
69 | <xsl:processing-instruction name="rfc">sortrefs='yes'</xsl:processing-instruction> |
---|
70 | <xsl:processing-instruction name="rfc">symrefs='yes'</xsl:processing-instruction> |
---|
71 | <xsl:processing-instruction name="rfc-ext">allow-markup-in-artwork='yes'</xsl:processing-instruction> |
---|
72 | <xsl:processing-instruction name="rfc-ext">include-references-in-index='yes'</xsl:processing-instruction> |
---|
73 | <xsl:processing-instruction name="rfc-ext">check-artwork-width='no'</xsl:processing-instruction> |
---|
74 | <rfc> |
---|
75 | <front> |
---|
76 | <title abbrev="xml2rfc refs for W3C specs">Xml2Rfc References For W3C Specifications</title> |
---|
77 | <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke" role="editor"> |
---|
78 | <organization abbrev="greenbytes">greenbytes GmbH</organization> |
---|
79 | <address> |
---|
80 | <postal> |
---|
81 | <street>Hafenweg 16</street> |
---|
82 | <city>Muenster</city><region>NW</region><code>48155</code> |
---|
83 | <country>Germany</country> |
---|
84 | </postal> |
---|
85 | <phone>+49 251 2807760</phone> |
---|
86 | <email>julian.reschke@greenbytes.de</email> |
---|
87 | <uri>http://greenbytes.de/tech/webdav/</uri> |
---|
88 | </address> |
---|
89 | </author> |
---|
90 | <date year="2012" /> |
---|
91 | </front> |
---|
92 | <middle> |
---|
93 | <section title="Introduction"> |
---|
94 | <t> |
---|
95 | Automatically generated from <eref target="http://www.w3.org/2002/01/tr-automation/tr.rdf"/> using |
---|
96 | <eref target="http://greenbytes.de/tech/webdav/rfc2629xslt/gen-w3c-reference.xslt"/>. |
---|
97 | </t> |
---|
98 | <t> |
---|
99 | Note that the ordering of authors is determined by retrieving the |
---|
100 | spec text and checking for the first occurance of the full author name. |
---|
101 | This may sometimes fail. If you find incorrect orderings, please |
---|
102 | notify <eref target="mailto:julian.reschke@gmx.de?subject=W3C%20author%20ordering">julian.reschke@gmx.de</eref>. |
---|
103 | </t> |
---|
104 | </section> |
---|
105 | <section title="<reference> elements"> |
---|
106 | <xsl:for-each select="/*/*[not(self::r:ActivityStatement or self::rdf:Description)]"> |
---|
107 | <xsl:sort select="substring-after(substring-after(substring-after(substring-after(@rdf:about,'//'),'/'),'/'),'/')"/> |
---|
108 | <xsl:call-template name="genref-figures"/> |
---|
109 | </xsl:for-each> |
---|
110 | </section> |
---|
111 | </middle> |
---|
112 | <back> |
---|
113 | <references> |
---|
114 | <xsl:for-each select="/*/*[not(self::r:ActivityStatement or self::rdf:Description)]"> |
---|
115 | <xsl:call-template name="genref"/> |
---|
116 | </xsl:for-each> |
---|
117 | </references> |
---|
118 | </back> |
---|
119 | </rfc> |
---|
120 | </xsl:otherwise> |
---|
121 | </xsl:choose> |
---|
122 | </xsl:template> |
---|
123 | |
---|
124 | <xsl:template name="basename"> |
---|
125 | <xsl:param name="s"/> |
---|
126 | <xsl:choose> |
---|
127 | <xsl:when test="contains($s,'/') and substring-after($s,'/')!=''"> |
---|
128 | <xsl:call-template name="basename"> |
---|
129 | <xsl:with-param name="s" select="substring-after($s,'/')"/> |
---|
130 | </xsl:call-template> |
---|
131 | </xsl:when> |
---|
132 | <xsl:otherwise> |
---|
133 | <xsl:value-of select="translate($s,'/','')"/> |
---|
134 | </xsl:otherwise> |
---|
135 | </xsl:choose> |
---|
136 | </xsl:template> |
---|
137 | |
---|
138 | <xsl:template name="genref"> |
---|
139 | <xsl:variable name="s"> |
---|
140 | <xsl:call-template name="basename"> |
---|
141 | <xsl:with-param name="s" select="@rdf:about"/> |
---|
142 | </xsl:call-template> |
---|
143 | </xsl:variable> |
---|
144 | |
---|
145 | <!-- exclude a few broken ones --> |
---|
146 | <xsl:if test="string-length(translate(substring($s,1,1),'0123456789',''))!=0"> |
---|
147 | <reference target="{@rdf:about}"> |
---|
148 | <xsl:attribute name="anchor"> |
---|
149 | <xsl:choose> |
---|
150 | <xsl:when test="$shortname!=''"> |
---|
151 | <xsl:value-of select="$shortname"/> |
---|
152 | </xsl:when> |
---|
153 | <xsl:otherwise> |
---|
154 | <xsl:value-of select="$s"/> |
---|
155 | </xsl:otherwise> |
---|
156 | </xsl:choose> |
---|
157 | </xsl:attribute> |
---|
158 | <front> |
---|
159 | <title><xsl:value-of select="dc:title"/></title> |
---|
160 | <xsl:apply-templates select="r:editor/contact:fullName|r:editor/org:name"/> |
---|
161 | <xsl:if test="count(r:editor/contact:fullName|r:editor/org:name)=0"> |
---|
162 | <xsl:message>No author information for <xsl:value-of select="$s"/></xsl:message> |
---|
163 | <author> |
---|
164 | <xsl:comment>author info missing</xsl:comment> |
---|
165 | <organization/> |
---|
166 | </author> |
---|
167 | </xsl:if> |
---|
168 | <date> |
---|
169 | <xsl:variable name="yyyy" select="substring-before(dc:date,'-')"/> |
---|
170 | <xsl:variable name="mmdd" select="substring-after(dc:date,'-')"/> |
---|
171 | <xsl:variable name="mm" select="substring-before($mmdd,'-')"/> |
---|
172 | <xsl:variable name="dd" select="substring-after($mmdd,'-')"/> |
---|
173 | <xsl:attribute name="year"> |
---|
174 | <xsl:value-of select="$yyyy"/> |
---|
175 | </xsl:attribute> |
---|
176 | <xsl:attribute name="month"> |
---|
177 | <xsl:call-template name="getmonth"><xsl:with-param name="mm" select="$mm"/></xsl:call-template> |
---|
178 | </xsl:attribute> |
---|
179 | <xsl:attribute name="day"> |
---|
180 | <xsl:value-of select="$dd"/> |
---|
181 | </xsl:attribute> |
---|
182 | </date> |
---|
183 | </front> |
---|
184 | <seriesInfo> |
---|
185 | <xsl:attribute name="name"> |
---|
186 | <xsl:call-template name="getseries"> |
---|
187 | <xsl:with-param name="s" select="$s"/> |
---|
188 | </xsl:call-template> |
---|
189 | </xsl:attribute> |
---|
190 | <xsl:attribute name="value"> |
---|
191 | <xsl:value-of select="$s"/> |
---|
192 | </xsl:attribute> |
---|
193 | </seriesInfo> |
---|
194 | <xsl:if test="doc:versionOf"> |
---|
195 | <annotation>Latest version available at <eref target="{doc:versionOf/@rdf:resource}"/>.</annotation> |
---|
196 | </xsl:if> |
---|
197 | </reference> |
---|
198 | </xsl:if> |
---|
199 | |
---|
200 | </xsl:template> |
---|
201 | |
---|
202 | <xsl:template name="genref-figures"> |
---|
203 | <xsl:variable name="s"> |
---|
204 | <xsl:call-template name="basename"> |
---|
205 | <xsl:with-param name="s" select="@rdf:about"/> |
---|
206 | </xsl:call-template> |
---|
207 | </xsl:variable> |
---|
208 | |
---|
209 | <!-- exclude a few broken ones --> |
---|
210 | <xsl:if test="string-length(translate(substring($s,1,1),'0123456789',''))!=0"> |
---|
211 | <xsl:variable name="link"> |
---|
212 | <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="@rdf:about"/></xsl:call-template> |
---|
213 | </xsl:variable> |
---|
214 | <xsl:variable name="anchor"> |
---|
215 | <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="$s"/></xsl:call-template> |
---|
216 | </xsl:variable> |
---|
217 | <xsl:variable name="latest"> |
---|
218 | <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="doc:versionOf/@rdf:resource"/></xsl:call-template> |
---|
219 | </xsl:variable> |
---|
220 | <xsl:variable name="tseries"> |
---|
221 | <xsl:call-template name="getseries"> |
---|
222 | <xsl:with-param name="s" select="$s"/> |
---|
223 | </xsl:call-template> |
---|
224 | </xsl:variable> |
---|
225 | <xsl:variable name="series"> |
---|
226 | <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="$tseries"/></xsl:call-template> |
---|
227 | </xsl:variable> |
---|
228 | <xsl:variable name="yyyy" select="substring-before(dc:date,'-')"/> |
---|
229 | <xsl:variable name="mmdd" select="substring-after(dc:date,'-')"/> |
---|
230 | <xsl:variable name="mm" select="substring-before($mmdd,'-')"/> |
---|
231 | <xsl:variable name="dd" select="substring-after($mmdd,'-')"/> |
---|
232 | <xsl:variable name="month"> |
---|
233 | <xsl:call-template name="getmonth"><xsl:with-param name="mm" select="$mm"/></xsl:call-template> |
---|
234 | </xsl:variable> |
---|
235 | <xsl:variable name="title"> |
---|
236 | <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="dc:title"/></xsl:call-template> |
---|
237 | </xsl:variable> |
---|
238 | |
---|
239 | <section title="{$s}: {dc:title}" anchor="ref-{$anchor}"> |
---|
240 | <iref item="{$tseries}" subitem="{$s}"/> |
---|
241 | <xsl:apply-templates select="r:editor/contact:fullName" mode="iref"> |
---|
242 | <xsl:with-param name="s" select="$s"/> |
---|
243 | </xsl:apply-templates> |
---|
244 | <t> |
---|
245 | Reference element for <xref target="{$s}"/>. |
---|
246 | </t> |
---|
247 | <figure><artwork type="inline"> |
---|
248 | <reference anchor='<xsl:value-of select="$anchor"/>' |
---|
249 | target='<xsl:value-of select="$link"/>'> |
---|
250 | <front> |
---|
251 | <title><xsl:value-of select="$title"/></title> |
---|
252 | <xsl:apply-templates select="r:editor/contact:fullName|r:editor/org:name" mode="figure"/> <date year='<xsl:value-of select="$yyyy"/>' month='<xsl:value-of select="$month"/>' day='<xsl:value-of select="$dd"/>'/> |
---|
253 | </front> |
---|
254 | <seriesInfo name='<xsl:value-of select="$series"/>' value='<xsl:value-of select="$anchor"/>'/> |
---|
255 | <xsl:if test="doc:versionOf"> <annotation> |
---|
256 | Latest version available at |
---|
257 | <eref target='<xsl:value-of select="$latest"/>'/>. |
---|
258 | </annotation> |
---|
259 | </xsl:if></reference> |
---|
260 | </artwork></figure> |
---|
261 | <xsl:if test="processing-instruction('sort-rdf')='alpha'"> |
---|
262 | <t> |
---|
263 | <spanx>The ordering of author names above may be incorrect.</spanx> |
---|
264 | </t> |
---|
265 | </xsl:if> |
---|
266 | </section> |
---|
267 | </xsl:if> |
---|
268 | |
---|
269 | </xsl:template> |
---|
270 | |
---|
271 | <xsl:template match="contact:fullName"> |
---|
272 | <xsl:variable name="surname"> |
---|
273 | <xsl:call-template name="getsurname"> |
---|
274 | <xsl:with-param name="s" select="normalize-space(.)"/> |
---|
275 | </xsl:call-template> |
---|
276 | </xsl:variable> |
---|
277 | <xsl:variable name="givenname" select="normalize-space(substring-before(normalize-space(.),$surname))"/> |
---|
278 | <xsl:variable name="initials"> |
---|
279 | <xsl:call-template name="getinitials"> |
---|
280 | <xsl:with-param name="s" select="$givenname"/> |
---|
281 | </xsl:call-template> |
---|
282 | </xsl:variable> |
---|
283 | |
---|
284 | <xsl:variable name="allowed">ABCDEFGHIJHKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.() -'0123456789</xsl:variable> |
---|
285 | |
---|
286 | <xsl:variable name="tmp" select="."/> |
---|
287 | <xsl:variable name="mapped" select="$map/map/entry[@key=$tmp]"/> |
---|
288 | <xsl:variable name="fn"> |
---|
289 | <xsl:choose> |
---|
290 | <xsl:when test="$mapped"><xsl:value-of select="$mapped/@fn"/></xsl:when> |
---|
291 | <xsl:otherwise><xsl:value-of select="$tmp"/></xsl:otherwise> |
---|
292 | </xsl:choose> |
---|
293 | </xsl:variable> |
---|
294 | <xsl:variable name="sn"> |
---|
295 | <xsl:choose> |
---|
296 | <xsl:when test="$mapped"><xsl:value-of select="$mapped/@surname"/></xsl:when> |
---|
297 | <xsl:otherwise><xsl:value-of select="$surname"/></xsl:otherwise> |
---|
298 | </xsl:choose> |
---|
299 | </xsl:variable> |
---|
300 | <xsl:variable name="i"> |
---|
301 | <xsl:choose> |
---|
302 | <xsl:when test="$mapped"><xsl:value-of select="$mapped/@initials"/></xsl:when> |
---|
303 | <xsl:otherwise><xsl:value-of select="$initials"/></xsl:otherwise> |
---|
304 | </xsl:choose> |
---|
305 | </xsl:variable> |
---|
306 | |
---|
307 | <xsl:if test="translate($fn,$allowed,'')!=''"> |
---|
308 | <xsl:message>WARNING: non-ASCII characters in <xsl:value-of select="$fn"/>: <xsl:value-of select="translate($fn,$allowed,'')"/></xsl:message> |
---|
309 | </xsl:if> |
---|
310 | <xsl:if test="translate($sn,$allowed,'')!=''"> |
---|
311 | <xsl:message>WARNING: non-ASCII characters in <xsl:value-of select="$sn"/>: <xsl:value-of select="translate($sn,$allowed,'')"/></xsl:message> |
---|
312 | </xsl:if> |
---|
313 | <xsl:if test="translate($i,$allowed,'')!=''"> |
---|
314 | <xsl:message>WARNING: non-ASCII characters in <xsl:value-of select="$i"/>: <xsl:value-of select="translate($i,$allowed,'')"/></xsl:message> |
---|
315 | </xsl:if> |
---|
316 | |
---|
317 | <author fullname="{$fn}" surname="{$sn}" initials="{normalize-space($i)}" /> |
---|
318 | </xsl:template> |
---|
319 | |
---|
320 | <xsl:template match="contact:fullName" mode="iref"> |
---|
321 | <xsl:param name="s"/> |
---|
322 | <xsl:variable name="surname"> |
---|
323 | <xsl:call-template name="getsurname"> |
---|
324 | <xsl:with-param name="s" select="normalize-space(.)"/> |
---|
325 | </xsl:call-template> |
---|
326 | </xsl:variable> |
---|
327 | <xsl:variable name="givenname" select="normalize-space(substring-before(normalize-space(.),$surname))"/> |
---|
328 | <xsl:variable name="initials"> |
---|
329 | <xsl:call-template name="getinitials"> |
---|
330 | <xsl:with-param name="s" select="$givenname"/> |
---|
331 | </xsl:call-template> |
---|
332 | </xsl:variable> |
---|
333 | <iref subitem="{$s}"> |
---|
334 | <xsl:attribute name="item"> |
---|
335 | <xsl:call-template name="filter"><xsl:with-param name="s" select="normalize-space($surname)"/></xsl:call-template> |
---|
336 | <xsl:text>, </xsl:text> |
---|
337 | <xsl:call-template name="filter"><xsl:with-param name="s" select="normalize-space($initials)"/></xsl:call-template> |
---|
338 | </xsl:attribute> |
---|
339 | </iref> |
---|
340 | </xsl:template> |
---|
341 | |
---|
342 | <xsl:template match="contact:fullName" mode="figure"> |
---|
343 | <xsl:variable name="surname"> |
---|
344 | <xsl:call-template name="getsurname"> |
---|
345 | <xsl:with-param name="s" select="normalize-space(.)"/> |
---|
346 | </xsl:call-template> |
---|
347 | </xsl:variable> |
---|
348 | <xsl:variable name="givenname" select="normalize-space(substring-before(normalize-space(.),$surname))"/> |
---|
349 | <xsl:variable name="initials"> |
---|
350 | <xsl:call-template name="getinitials"> |
---|
351 | <xsl:with-param name="s" select="$givenname"/> |
---|
352 | </xsl:call-template> |
---|
353 | </xsl:variable> |
---|
354 | <xsl:variable name="tmp" select="."/> |
---|
355 | <xsl:variable name="mapped" select="$map/map/entry[@key=$tmp]"/> |
---|
356 | <xsl:variable name="fn"> |
---|
357 | <xsl:choose> |
---|
358 | <xsl:when test="$mapped"><xsl:value-of select="$mapped/@fn"/></xsl:when> |
---|
359 | <xsl:otherwise><xsl:value-of select="$tmp"/></xsl:otherwise> |
---|
360 | </xsl:choose> |
---|
361 | </xsl:variable> |
---|
362 | <xsl:variable name="sn"> |
---|
363 | <xsl:choose> |
---|
364 | <xsl:when test="$mapped"><xsl:value-of select="$mapped/@surname"/></xsl:when> |
---|
365 | <xsl:otherwise><xsl:value-of select="$surname"/></xsl:otherwise> |
---|
366 | </xsl:choose> |
---|
367 | </xsl:variable> |
---|
368 | <xsl:variable name="i"> |
---|
369 | <xsl:choose> |
---|
370 | <xsl:when test="$mapped"><xsl:value-of select="$mapped/@initials"/></xsl:when> |
---|
371 | <xsl:otherwise><xsl:value-of select="$initials"/></xsl:otherwise> |
---|
372 | </xsl:choose> |
---|
373 | </xsl:variable> |
---|
374 | |
---|
375 | <xsl:text> <author fullname='</xsl:text> |
---|
376 | <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="$fn"/></xsl:call-template> |
---|
377 | <xsl:text>' surname='</xsl:text> |
---|
378 | <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="$sn"/></xsl:call-template> |
---|
379 | <xsl:text>' initials='</xsl:text> |
---|
380 | <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="$i"/></xsl:call-template> |
---|
381 | <xsl:text>'/> </xsl:text> |
---|
382 | </xsl:template> |
---|
383 | |
---|
384 | <xsl:template match="org:name"> |
---|
385 | <author> |
---|
386 | <organization><xsl:value-of select="."/></organization> |
---|
387 | </author> |
---|
388 | </xsl:template> |
---|
389 | |
---|
390 | <xsl:template match="org:name" mode="figure"> |
---|
391 | <xsl:text> <author> </xsl:text> |
---|
392 | <xsl:text> <organization></xsl:text> |
---|
393 | <xsl:call-template name="escapefilter"><xsl:with-param name="s" select="."/></xsl:call-template> |
---|
394 | <xsl:text></organization> </xsl:text> |
---|
395 | <xsl:text> </author> </xsl:text> |
---|
396 | </xsl:template> |
---|
397 | |
---|
398 | <xsl:variable name="editors" select="document('known-tr-editors.rdf')"/> |
---|
399 | <xsl:variable name="map" select="document('w3c-author-map.xml')"/> |
---|
400 | |
---|
401 | <xsl:template name="getseries"> |
---|
402 | <xsl:param name="s"/> |
---|
403 | <xsl:choose> |
---|
404 | <xsl:when test="starts-with($s,'CR-')">W3C Candidate Recommendation</xsl:when> |
---|
405 | <xsl:when test="starts-with($s,'NOTE-')">W3C Group Note</xsl:when> |
---|
406 | <xsl:when test="starts-with($s,'PER-')">W3C Proposed Edited Recommendation</xsl:when> |
---|
407 | <xsl:when test="starts-with($s,'PR-')">W3C Proposed Recommendation</xsl:when> |
---|
408 | <xsl:when test="starts-with($s,'REC-')">W3C Recommendation</xsl:when> |
---|
409 | <xsl:when test="starts-with($s,'WD-')">W3C Working Draft</xsl:when> |
---|
410 | <xsl:otherwise>W3C ???</xsl:otherwise> |
---|
411 | </xsl:choose> |
---|
412 | </xsl:template> |
---|
413 | |
---|
414 | <xsl:template name="getmonth"> |
---|
415 | <xsl:param name="mm"/> |
---|
416 | <xsl:choose> |
---|
417 | <xsl:when test="$mm=1">January</xsl:when> |
---|
418 | <xsl:when test="$mm=2">Febuary</xsl:when> |
---|
419 | <xsl:when test="$mm=3">March</xsl:when> |
---|
420 | <xsl:when test="$mm=4">April</xsl:when> |
---|
421 | <xsl:when test="$mm=5">May</xsl:when> |
---|
422 | <xsl:when test="$mm=6">June</xsl:when> |
---|
423 | <xsl:when test="$mm=7">July</xsl:when> |
---|
424 | <xsl:when test="$mm=8">August</xsl:when> |
---|
425 | <xsl:when test="$mm=9">September</xsl:when> |
---|
426 | <xsl:when test="$mm=10">October</xsl:when> |
---|
427 | <xsl:when test="$mm=11">November</xsl:when> |
---|
428 | <xsl:when test="$mm=12">December</xsl:when> |
---|
429 | </xsl:choose> |
---|
430 | </xsl:template> |
---|
431 | |
---|
432 | <xsl:template name="getsurname"> |
---|
433 | <xsl:param name="s"/> |
---|
434 | <xsl:choose> |
---|
435 | <xsl:when test="$editors//contact:lastName=$s"> |
---|
436 | <xsl:value-of select="$s"/> |
---|
437 | </xsl:when> |
---|
438 | <xsl:when test="contains($s,' ')"> |
---|
439 | <xsl:call-template name="getsurname"> |
---|
440 | <xsl:with-param name="s" select="substring-after($s,' ')"/> |
---|
441 | </xsl:call-template> |
---|
442 | </xsl:when> |
---|
443 | <xsl:otherwise> |
---|
444 | <xsl:value-of select="$s"/> |
---|
445 | </xsl:otherwise> |
---|
446 | </xsl:choose> |
---|
447 | </xsl:template> |
---|
448 | |
---|
449 | <xsl:template name="getinitials"> |
---|
450 | <xsl:param name="s"/> |
---|
451 | <xsl:choose> |
---|
452 | <xsl:when test="contains($s,' ')"> |
---|
453 | <xsl:value-of select="substring($s,1,1)"/><xsl:text>. </xsl:text> |
---|
454 | <xsl:call-template name="getinitials"> |
---|
455 | <xsl:with-param name="s" select="substring-after($s,' ')"/> |
---|
456 | </xsl:call-template> |
---|
457 | </xsl:when> |
---|
458 | <xsl:otherwise> |
---|
459 | <xsl:value-of select="substring($s,1,1)"/><xsl:text>. </xsl:text> |
---|
460 | </xsl:otherwise> |
---|
461 | </xsl:choose> |
---|
462 | </xsl:template> |
---|
463 | |
---|
464 | <xsl:template name="escapefilter"> |
---|
465 | <xsl:param name="s"/> |
---|
466 | <xsl:choose> |
---|
467 | <xsl:when test="$s!=''"> |
---|
468 | <xsl:variable name="apos">'</xsl:variable> |
---|
469 | <xsl:variable name="l" select="substring($s,1,1)"/> |
---|
470 | <xsl:choose> |
---|
471 | <xsl:when test="$l='&'"> |
---|
472 | <xsl:text>&amp;</xsl:text> |
---|
473 | </xsl:when> |
---|
474 | <xsl:when test="$l='"'"> |
---|
475 | <xsl:text>&quot;</xsl:text> |
---|
476 | </xsl:when> |
---|
477 | <xsl:when test="$l=$apos"> |
---|
478 | <xsl:text>&apos;</xsl:text> |
---|
479 | </xsl:when> |
---|
480 | <xsl:when test="$l='™'"> |
---|
481 | <xsl:text>(tm)</xsl:text> |
---|
482 | </xsl:when> |
---|
483 | <xsl:otherwise> |
---|
484 | <xsl:value-of select="$l"/> |
---|
485 | </xsl:otherwise> |
---|
486 | </xsl:choose> |
---|
487 | <xsl:call-template name="escapefilter"> |
---|
488 | <xsl:with-param name="s" select="substring($s,2)"/> |
---|
489 | </xsl:call-template> |
---|
490 | </xsl:when> |
---|
491 | <xsl:otherwise/> |
---|
492 | </xsl:choose> |
---|
493 | </xsl:template> |
---|
494 | |
---|
495 | <xsl:template name="filter"> |
---|
496 | <xsl:param name="s"/> |
---|
497 | <xsl:choose> |
---|
498 | <xsl:when test="$s!=''"> |
---|
499 | <xsl:variable name="l" select="substring($s,1,1)"/> |
---|
500 | <xsl:choose> |
---|
501 | <xsl:when test="$l='™'"> |
---|
502 | <xsl:text>(tm)</xsl:text> |
---|
503 | </xsl:when> |
---|
504 | <xsl:otherwise> |
---|
505 | <xsl:value-of select="$l"/> |
---|
506 | </xsl:otherwise> |
---|
507 | </xsl:choose> |
---|
508 | <xsl:call-template name="filter"> |
---|
509 | <xsl:with-param name="s" select="substring($s,2)"/> |
---|
510 | </xsl:call-template> |
---|
511 | </xsl:when> |
---|
512 | <xsl:otherwise/> |
---|
513 | </xsl:choose> |
---|
514 | </xsl:template> |
---|
515 | |
---|
516 | </xsl:transform> |
---|