1 | <!-- |
---|
2 | Strip rfc2629.xslt extensions, generating XML input for MTR's xml2rfc |
---|
3 | |
---|
4 | Copyright (c) 2006-2009, Julian Reschke (julian.reschke@greenbytes.de) |
---|
5 | All rights reserved. |
---|
6 | |
---|
7 | Redistribution and use in source and binary forms, with or without |
---|
8 | modification, are permitted provided that the following conditions are met: |
---|
9 | |
---|
10 | * Redistributions of source code must retain the above copyright notice, |
---|
11 | this list of conditions and the following disclaimer. |
---|
12 | * Redistributions in binary form must reproduce the above copyright notice, |
---|
13 | this list of conditions and the following disclaimer in the documentation |
---|
14 | and/or other materials provided with the distribution. |
---|
15 | * Neither the name of Julian Reschke nor the names of its contributors |
---|
16 | may be used to endorse or promote products derived from this software |
---|
17 | without specific prior written permission. |
---|
18 | |
---|
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
29 | POSSIBILITY OF SUCH DAMAGE. |
---|
30 | --> |
---|
31 | |
---|
32 | <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
33 | version="1.0" |
---|
34 | xmlns:ed="http://greenbytes.de/2002/rfcedit" |
---|
35 | xmlns:grddl="http://www.w3.org/2003/g/data-view#" |
---|
36 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
37 | xmlns:x="http://purl.org/net/xml2rfc/ext" |
---|
38 | xmlns:xhtml="http://www.w3.org/1999/xhtml" |
---|
39 | exclude-result-prefixes="ed grddl rdf x xhtml" |
---|
40 | > |
---|
41 | |
---|
42 | <!-- re-use some of the default RFC2629.xslt rules --> |
---|
43 | <xsl:import href="rfc2629.xslt"/> |
---|
44 | |
---|
45 | <!-- undo strip-space decls --> |
---|
46 | <xsl:preserve-space elements="*"/> |
---|
47 | |
---|
48 | <!-- generate DTD-valid output, override all values imported from rfc2629.xslt --> |
---|
49 | <xsl:output doctype-system="rfc2629.dtd" doctype-public="" method="xml" version="1.0" encoding="UTF-8" cdata-section-elements="artwork" /> |
---|
50 | |
---|
51 | <!-- kick into cleanup mode --> |
---|
52 | <xsl:template match="/"> |
---|
53 | <xsl:text> </xsl:text> |
---|
54 | <xsl:comment> |
---|
55 | This XML document is the output of clean-for-DTD.xslt; a tool that strips |
---|
56 | extensions to RFC2629(bis) from documents for processing with xml2rfc. |
---|
57 | </xsl:comment> |
---|
58 | <xsl:apply-templates select="/" mode="cleanup"/> |
---|
59 | </xsl:template> |
---|
60 | |
---|
61 | <!-- rules for identity transformations --> |
---|
62 | |
---|
63 | <xsl:template match="processing-instruction()" mode="cleanup"> |
---|
64 | <xsl:text> </xsl:text> |
---|
65 | <xsl:copy/> |
---|
66 | </xsl:template> |
---|
67 | |
---|
68 | <xsl:template match="comment()|@*" mode="cleanup"><xsl:copy/></xsl:template> |
---|
69 | |
---|
70 | <xsl:template match="text()" mode="cleanup"><xsl:copy/></xsl:template> |
---|
71 | |
---|
72 | <xsl:template match="/" mode="cleanup"> |
---|
73 | <xsl:copy><xsl:apply-templates select="node()" mode="cleanup" /></xsl:copy> |
---|
74 | </xsl:template> |
---|
75 | |
---|
76 | <xsl:template match="*" mode="cleanup"> |
---|
77 | <xsl:element name="{local-name()}"> |
---|
78 | <xsl:apply-templates select="node()|@*" mode="cleanup" /> |
---|
79 | </xsl:element> |
---|
80 | </xsl:template> |
---|
81 | |
---|
82 | |
---|
83 | <!-- remove PI extensions --> |
---|
84 | |
---|
85 | <xsl:template match="processing-instruction('rfc-ext')" mode="cleanup"/> |
---|
86 | |
---|
87 | <!-- add issues appendix --> |
---|
88 | |
---|
89 | <xsl:template match="back" mode="cleanup"> |
---|
90 | <back> |
---|
91 | <xsl:apply-templates select="node()|@*" mode="cleanup" /> |
---|
92 | <xsl:if test="not(/*/@ed:suppress-issue-appendix='yes') and //ed:issue[@status='closed']"> |
---|
93 | <section title="Resolved issues (to be removed by RFC Editor before publication)"> |
---|
94 | <t> |
---|
95 | Issues that were either rejected or resolved in this version of this |
---|
96 | document. |
---|
97 | </t> |
---|
98 | <xsl:apply-templates select="//ed:issue[@status='closed']" mode="issues" /> |
---|
99 | </section> |
---|
100 | </xsl:if> |
---|
101 | <xsl:if test="not(/*/@ed:suppress-issue-appendix='yes') and //ed:issue[@status='open']"> |
---|
102 | <section title="Open issues (to be removed by RFC Editor prior to publication)"> |
---|
103 | <xsl:apply-templates select="//ed:issue[@status!='closed']" mode="issues" /> |
---|
104 | </section> |
---|
105 | </xsl:if> |
---|
106 | </back> |
---|
107 | </xsl:template> |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | |
---|
112 | <!-- extensions --> |
---|
113 | |
---|
114 | <xsl:template match="x:abnf-char-sequence" mode="cleanup"> |
---|
115 | <xsl:choose> |
---|
116 | <xsl:when test="substring(.,1,1) != '"' or substring(.,string-length(.),1) != '"'"> |
---|
117 | <xsl:call-template name="error"> |
---|
118 | <xsl:with-param name="msg" select="'contents of x:abnf-char-sequence needs to be quoted.'" /> |
---|
119 | </xsl:call-template> |
---|
120 | </xsl:when> |
---|
121 | <xsl:otherwise> |
---|
122 | <xsl:text>%x</xsl:text> |
---|
123 | <xsl:call-template name="to-abnf-char-sequence"> |
---|
124 | <xsl:with-param name="chars" select="substring(.,2,string-length(.)-2)"/> |
---|
125 | </xsl:call-template> |
---|
126 | </xsl:otherwise> |
---|
127 | </xsl:choose> |
---|
128 | </xsl:template> |
---|
129 | |
---|
130 | <xsl:template match="x:anchor-alias" mode="cleanup"/> |
---|
131 | |
---|
132 | <xsl:template match="x:bcp14" mode="cleanup"> |
---|
133 | <xsl:apply-templates/> |
---|
134 | </xsl:template> |
---|
135 | |
---|
136 | <xsl:template match="x:assign-section-number" mode="cleanup"/> |
---|
137 | <xsl:template match="x:link" mode="cleanup"/> |
---|
138 | <xsl:template match="x:source" mode="cleanup"/> |
---|
139 | |
---|
140 | <xsl:template match="x:parse-xml" mode="cleanup"> |
---|
141 | <xsl:apply-templates/> |
---|
142 | </xsl:template> |
---|
143 | |
---|
144 | <xsl:template match="x:ref" mode="cleanup"> |
---|
145 | <xsl:variable name="val" select="."/> |
---|
146 | <xsl:variable name="target" select="//*[@anchor and (@anchor=$val or x:anchor-alias/@value=$val)]"/> |
---|
147 | <xsl:choose> |
---|
148 | <xsl:when test="$target"> |
---|
149 | <xsl:variable name="current" select="."/> |
---|
150 | <xsl:for-each select="$target"> |
---|
151 | <!-- make it the context --> |
---|
152 | <xsl:choose> |
---|
153 | <xsl:when test="self::preamble"> |
---|
154 | <!-- it's not an element we can link to --> |
---|
155 | <xsl:comment>clean-for-DTD.xslt warning: couldn't create the link as <xsl:value-of select="name()"/> does not support the anchor attribute.</xsl:comment> |
---|
156 | <xsl:value-of select="$current"/> |
---|
157 | </xsl:when> |
---|
158 | <xsl:otherwise> |
---|
159 | <xref target="{$target/@anchor}" format="none"><xsl:value-of select="$current"/></xref> |
---|
160 | </xsl:otherwise> |
---|
161 | </xsl:choose> |
---|
162 | </xsl:for-each> |
---|
163 | </xsl:when> |
---|
164 | <xsl:otherwise> |
---|
165 | <xsl:message>WARNING: internal link target for '<xsl:value-of select="."/>' does not exist.</xsl:message> |
---|
166 | <xsl:value-of select="."/> |
---|
167 | </xsl:otherwise> |
---|
168 | </xsl:choose> |
---|
169 | </xsl:template> |
---|
170 | |
---|
171 | <xsl:template match="x:blockquote" mode="cleanup"> |
---|
172 | <t><list> |
---|
173 | <xsl:apply-templates mode="cleanup" /> |
---|
174 | </list></t> |
---|
175 | </xsl:template> |
---|
176 | |
---|
177 | <xsl:template match="x:h" mode="cleanup"> |
---|
178 | <xsl:apply-templates mode="cleanup" /> |
---|
179 | </xsl:template> |
---|
180 | |
---|
181 | <xsl:template match="x:highlight" mode="cleanup"> |
---|
182 | <xsl:apply-templates mode="cleanup" /> |
---|
183 | </xsl:template> |
---|
184 | |
---|
185 | <xsl:template match="x:lt" mode="cleanup"> |
---|
186 | <t> |
---|
187 | <xsl:apply-templates select="@hangText|@anchor" mode="cleanup"/> |
---|
188 | <xsl:for-each select="t"> |
---|
189 | <xsl:apply-templates mode="cleanup"/> |
---|
190 | <xsl:if test="position()!=last()"> |
---|
191 | <vspace blankLines="1"/> |
---|
192 | </xsl:if> |
---|
193 | </xsl:for-each> |
---|
194 | </t> |
---|
195 | </xsl:template> |
---|
196 | |
---|
197 | <xsl:template match="x:note" mode="cleanup"> |
---|
198 | <t> |
---|
199 | <list> |
---|
200 | <xsl:apply-templates mode="cleanup"/> |
---|
201 | </list> |
---|
202 | </t> |
---|
203 | </xsl:template> |
---|
204 | |
---|
205 | <xsl:template match="x:q" mode="cleanup"> |
---|
206 | <xsl:text>"</xsl:text> |
---|
207 | <xsl:apply-templates mode="cleanup"/> |
---|
208 | <xsl:text>"</xsl:text> |
---|
209 | </xsl:template> |
---|
210 | |
---|
211 | <xsl:template match="x:dfn" mode="cleanup"> |
---|
212 | <!-- help xml2rfc to keep dfn and following text on the same page --> |
---|
213 | <xsl:if test="not(preceding-sibling::x:dfn) and count(following-sibling::list)=1"> |
---|
214 | <xsl:processing-instruction name="rfc">needLines="4"</xsl:processing-instruction> |
---|
215 | </xsl:if> |
---|
216 | <xsl:apply-templates mode="cleanup"/> |
---|
217 | </xsl:template> |
---|
218 | |
---|
219 | <xsl:template match="x:sup" mode="cleanup"> |
---|
220 | <xsl:text>^</xsl:text> |
---|
221 | <xsl:apply-templates mode="cleanup" /> |
---|
222 | </xsl:template> |
---|
223 | |
---|
224 | <xsl:template match="author/@anchor" mode="cleanup"/> |
---|
225 | <xsl:template match="x:include-author" mode="cleanup"> |
---|
226 | <t> |
---|
227 | <xsl:value-of select="/*/front/author[@anchor=current()/@target]"/> |
---|
228 | </t> |
---|
229 | <t> |
---|
230 | (see Authors Section) |
---|
231 | </t> |
---|
232 | </xsl:template> |
---|
233 | |
---|
234 | <!-- extended reference formatting --> |
---|
235 | |
---|
236 | <xsl:template match="xref[@x:* and not(node())]" mode="cleanup"> |
---|
237 | <xsl:variable name="node" select="$src//*[@anchor=current()/@target]" /> |
---|
238 | |
---|
239 | <xsl:variable name="sec"> |
---|
240 | <xsl:choose> |
---|
241 | <xsl:when test="starts-with(@x:rel,'#') and not(@x:sec) and $node/x:source/@href"> |
---|
242 | <xsl:variable name="extdoc" select="document($node/x:source/@href)"/> |
---|
243 | <xsl:for-each select="$extdoc//*[@anchor=substring-after(current()/@x:rel,'#')]"> |
---|
244 | <xsl:call-template name="get-section-number"/> |
---|
245 | </xsl:for-each> |
---|
246 | </xsl:when> |
---|
247 | <xsl:otherwise> |
---|
248 | <xsl:value-of select="@x:sec"/> |
---|
249 | </xsl:otherwise> |
---|
250 | </xsl:choose> |
---|
251 | </xsl:variable> |
---|
252 | |
---|
253 | <xsl:variable name="secterm"> |
---|
254 | <xsl:choose> |
---|
255 | <!-- starts with letter? --> |
---|
256 | <xsl:when test="translate(substring($sec,1,1),$ucase,'')=''">Appendix</xsl:when> |
---|
257 | <xsl:otherwise>Section</xsl:otherwise> |
---|
258 | </xsl:choose> |
---|
259 | </xsl:variable> |
---|
260 | |
---|
261 | <xsl:variable name="fmt"> |
---|
262 | <xsl:choose> |
---|
263 | <xsl:when test="@x:fmt!=''"><xsl:value-of select="@x:fmt"/></xsl:when> |
---|
264 | <xsl:when test="ancestor::artwork">,</xsl:when> |
---|
265 | <xsl:otherwise>of</xsl:otherwise> |
---|
266 | </xsl:choose> |
---|
267 | </xsl:variable> |
---|
268 | |
---|
269 | <xsl:choose> |
---|
270 | <xsl:when test="$fmt=','"> |
---|
271 | <xref> |
---|
272 | <xsl:apply-templates select="@target|@format|@pageno|text()|*" mode="cleanup"/> |
---|
273 | </xref> |
---|
274 | <xsl:text>, </xsl:text> |
---|
275 | <xsl:value-of select="$secterm"/> |
---|
276 | <xsl:text> </xsl:text> |
---|
277 | <xsl:value-of select="$sec"/> |
---|
278 | </xsl:when> |
---|
279 | <xsl:when test="$fmt='sec'"> |
---|
280 | <xsl:value-of select="$secterm"/> |
---|
281 | <xsl:text> </xsl:text> |
---|
282 | <xsl:value-of select="$sec"/> |
---|
283 | </xsl:when> |
---|
284 | <xsl:when test="$fmt='number'"> |
---|
285 | <xsl:value-of select="$sec"/> |
---|
286 | </xsl:when> |
---|
287 | <xsl:when test="$fmt='()'"> |
---|
288 | <xref> |
---|
289 | <xsl:apply-templates select="@target|@format|@pageno|text()|*" mode="cleanup"/> |
---|
290 | </xref> |
---|
291 | <xsl:text> (</xsl:text> |
---|
292 | <xsl:value-of select="$secterm"/> |
---|
293 | <xsl:text> </xsl:text> |
---|
294 | <xsl:value-of select="$sec"/> |
---|
295 | <xsl:text>)</xsl:text> |
---|
296 | </xsl:when> |
---|
297 | <xsl:when test="$fmt='of'"> |
---|
298 | <xsl:value-of select="$secterm"/> |
---|
299 | <xsl:text> </xsl:text> |
---|
300 | <xsl:value-of select="$sec"/> |
---|
301 | <xsl:text> of </xsl:text> |
---|
302 | <xref> |
---|
303 | <xsl:apply-templates select="@target|@format|@pageno|text()|*" mode="cleanup"/> |
---|
304 | </xref> |
---|
305 | </xsl:when> |
---|
306 | <xsl:when test="$fmt='anchor'"> |
---|
307 | <xsl:variable name="val"> |
---|
308 | <xsl:call-template name="referencename"> |
---|
309 | <xsl:with-param name="node" select="$node" /> |
---|
310 | </xsl:call-template> |
---|
311 | </xsl:variable> |
---|
312 | <!-- remove brackets --> |
---|
313 | <xsl:value-of select="substring($val,2,string-length($val)-2)"/> |
---|
314 | </xsl:when> |
---|
315 | <xsl:otherwise> |
---|
316 | <xsl:copy> |
---|
317 | <xsl:apply-templates select="node()" mode="cleanup"/> |
---|
318 | </xsl:copy> |
---|
319 | </xsl:otherwise> |
---|
320 | </xsl:choose> |
---|
321 | </xsl:template> |
---|
322 | |
---|
323 | <xsl:template match="xref[@x:fmt and node()]" mode="cleanup"> |
---|
324 | <xsl:choose> |
---|
325 | <xsl:when test="@x:fmt='none'"> |
---|
326 | <xsl:apply-templates mode="cleanup"/> |
---|
327 | </xsl:when> |
---|
328 | <xsl:when test="not(@x:fmt)"> |
---|
329 | <xref> |
---|
330 | <xsl:copy-of select="@target|@format"/> |
---|
331 | <xsl:apply-templates mode="cleanup"/> |
---|
332 | </xref> |
---|
333 | </xsl:when> |
---|
334 | <xsl:otherwise> |
---|
335 | <xsl:message>Unsupported x:fmt attribute.</xsl:message> |
---|
336 | </xsl:otherwise> |
---|
337 | </xsl:choose> |
---|
338 | </xsl:template> |
---|
339 | |
---|
340 | <xsl:template match="xref[node() and @target=//preamble/@anchor]" mode="cleanup"> |
---|
341 | <!-- remove the link --> |
---|
342 | <xsl:apply-templates select="node()" mode="cleanup"/> |
---|
343 | </xsl:template> |
---|
344 | |
---|
345 | <xsl:template match="xref[not(node()) and @target=//preamble/@anchor]" mode="cleanup"> |
---|
346 | <!-- fatal --> |
---|
347 | <xsl:message>Broken xref due to target being filtered out.</xsl:message> |
---|
348 | </xsl:template> |
---|
349 | |
---|
350 | <!-- issue tracking extensions --> |
---|
351 | |
---|
352 | <xsl:template match="@xml:lang" mode="cleanup"/> |
---|
353 | <xsl:template match="@xml:lang" /> |
---|
354 | |
---|
355 | <xsl:template match="ed:*" mode="cleanup"/> |
---|
356 | <xsl:template match="ed:*" /> |
---|
357 | |
---|
358 | <xsl:template match="@ed:*" mode="cleanup"/> |
---|
359 | <xsl:template match="@ed:*" /> |
---|
360 | |
---|
361 | <xsl:template match="ed:annotation" mode="cleanup" /> |
---|
362 | |
---|
363 | <xsl:template match="ed:replace" mode="cleanup"> |
---|
364 | <xsl:apply-templates mode="cleanup" /> |
---|
365 | </xsl:template> |
---|
366 | |
---|
367 | <xsl:template match="ed:replace"> |
---|
368 | <xsl:apply-templates/> |
---|
369 | </xsl:template> |
---|
370 | |
---|
371 | <xsl:template match="ed:ins" mode="cleanup"> |
---|
372 | <xsl:apply-templates mode="cleanup"/> |
---|
373 | </xsl:template> |
---|
374 | |
---|
375 | <xsl:template match="ed:ins"> |
---|
376 | <xsl:apply-templates/> |
---|
377 | </xsl:template> |
---|
378 | |
---|
379 | <xsl:template match="ed:issue" mode="issues"> |
---|
380 | <section title="{@name}"> |
---|
381 | <xsl:variable name="sec"> |
---|
382 | <xsl:call-template name="get-section-number"/> |
---|
383 | </xsl:variable> |
---|
384 | |
---|
385 | <xsl:if test="$sec!=''"> |
---|
386 | <t> |
---|
387 | In Section <xsl:value-of select="$sec"/>: |
---|
388 | </t> |
---|
389 | </xsl:if> |
---|
390 | |
---|
391 | <t> |
---|
392 | Type: <xsl:value-of select="@type" /> |
---|
393 | </t> |
---|
394 | <xsl:if test="@href"> |
---|
395 | <t> |
---|
396 | <!-- temp. removed because of xml2rfc's handling of erefs when producing TXT--> |
---|
397 | <!--<eref target="{@href}" /> --> |
---|
398 | <xsl:text><</xsl:text> |
---|
399 | <xsl:value-of select="@href"/> |
---|
400 | <xsl:text>></xsl:text> |
---|
401 | <xsl:if test="@alternate-href"> |
---|
402 | <xsl:text>, <</xsl:text> |
---|
403 | <xsl:value-of select="@alternate-href"/> |
---|
404 | <xsl:text>></xsl:text> |
---|
405 | </xsl:if> |
---|
406 | </t> |
---|
407 | </xsl:if> |
---|
408 | <xsl:for-each select="ed:item"> |
---|
409 | <t> |
---|
410 | <xsl:if test="@entered-by or @date"> |
---|
411 | <xsl:choose> |
---|
412 | <xsl:when test="not(@entered-by)"> |
---|
413 | <xsl:value-of select="concat('(',@date,') ')" /> |
---|
414 | </xsl:when> |
---|
415 | <xsl:when test="not(@date)"> |
---|
416 | <xsl:value-of select="concat(@entered-by,': ')" /> |
---|
417 | </xsl:when> |
---|
418 | <xsl:otherwise> |
---|
419 | <xsl:value-of select="concat(@entered-by,' (',@date,'): ')" /> |
---|
420 | </xsl:otherwise> |
---|
421 | </xsl:choose> |
---|
422 | </xsl:if> |
---|
423 | <xsl:if test="not(xhtml:p)"> |
---|
424 | <xsl:apply-templates select="node()" mode="issues"/> |
---|
425 | </xsl:if> |
---|
426 | </t> |
---|
427 | <xsl:if test="xhtml:p|xhtml:pre"> |
---|
428 | <xsl:for-each select="node()"> |
---|
429 | <xsl:choose> |
---|
430 | <xsl:when test="self::xhtml:p"> |
---|
431 | <t> |
---|
432 | <xsl:apply-templates select="node()" mode="issues"/> |
---|
433 | </t> |
---|
434 | </xsl:when> |
---|
435 | <xsl:when test="self::xhtml:pre"> |
---|
436 | <figure> |
---|
437 | <artwork><xsl:apply-templates select="node()" mode="issues"/></artwork> |
---|
438 | </figure> |
---|
439 | </xsl:when> |
---|
440 | <xsl:otherwise> |
---|
441 | <t> |
---|
442 | <xsl:apply-templates select="." mode="issues"/> |
---|
443 | </t> |
---|
444 | </xsl:otherwise> |
---|
445 | </xsl:choose> |
---|
446 | </xsl:for-each> |
---|
447 | </xsl:if> |
---|
448 | </xsl:for-each> |
---|
449 | <xsl:if test="ed:resolution"> |
---|
450 | <t> |
---|
451 | <xsl:text>Resolution</xsl:text> |
---|
452 | <xsl:if test="ed:resolution/@datetime"> (<xsl:value-of select="ed:resolution/@datetime"/>)</xsl:if> |
---|
453 | <xsl:text>: </xsl:text> |
---|
454 | <xsl:value-of select="ed:resolution" /> |
---|
455 | </t> |
---|
456 | </xsl:if> |
---|
457 | </section> |
---|
458 | </xsl:template> |
---|
459 | |
---|
460 | <xsl:template match="ed:issueref" mode="cleanup"> |
---|
461 | <xsl:apply-templates mode="cleanup"/> |
---|
462 | </xsl:template> |
---|
463 | |
---|
464 | <xsl:template match="*" mode="issues"> |
---|
465 | <xsl:apply-templates mode="issues"/> |
---|
466 | </xsl:template> |
---|
467 | |
---|
468 | <xsl:template match="xhtml:q" mode="issues"> |
---|
469 | <list><t> |
---|
470 | <xsl:text>"</xsl:text> |
---|
471 | <xsl:apply-templates mode="issues"/> |
---|
472 | <xsl:text>"</xsl:text> |
---|
473 | <xsl:if test="@cite"> |
---|
474 | <xsl:text> -- </xsl:text> |
---|
475 | <eref target="{@cite}"><xsl:value-of select="@cite"/></eref> |
---|
476 | </xsl:if> |
---|
477 | </t></list> |
---|
478 | </xsl:template> |
---|
479 | |
---|
480 | <xsl:template match="xhtml:br" mode="issues"> |
---|
481 | <vspace/> |
---|
482 | </xsl:template> |
---|
483 | |
---|
484 | <xsl:template match="xhtml:del" mode="issues"> |
---|
485 | <xsl:text><del></xsl:text> |
---|
486 | <xsl:apply-templates mode="issues"/> |
---|
487 | <xsl:text></del></xsl:text> |
---|
488 | </xsl:template> |
---|
489 | |
---|
490 | <xsl:template match="xhtml:em" mode="issues"> |
---|
491 | <spanx style="emph"> |
---|
492 | <xsl:apply-templates mode="issues"/> |
---|
493 | </spanx> |
---|
494 | </xsl:template> |
---|
495 | |
---|
496 | <xsl:template match="xhtml:ins" mode="issues"> |
---|
497 | <xsl:text><ins></xsl:text> |
---|
498 | <xsl:apply-templates mode="issues"/> |
---|
499 | <xsl:text></ins></xsl:text> |
---|
500 | </xsl:template> |
---|
501 | |
---|
502 | <xsl:template match="xhtml:tt" mode="issues"> |
---|
503 | <xsl:apply-templates mode="issues"/> |
---|
504 | </xsl:template> |
---|
505 | |
---|
506 | <xsl:template match="ed:eref" mode="issues"> |
---|
507 | <xsl:text><</xsl:text> |
---|
508 | <xsl:value-of select="."/> |
---|
509 | <xsl:text>></xsl:text> |
---|
510 | </xsl:template> |
---|
511 | |
---|
512 | <xsl:template match="ed:issueref" mode="issues"> |
---|
513 | <xsl:apply-templates mode="issues"/> |
---|
514 | </xsl:template> |
---|
515 | |
---|
516 | <xsl:template match="text()" mode="issues"> |
---|
517 | <xsl:value-of select="." /> |
---|
518 | </xsl:template> |
---|
519 | |
---|
520 | |
---|
521 | |
---|
522 | <!-- markup inside artwork element --> |
---|
523 | |
---|
524 | <xsl:template match="figure[.//artwork//iref]" mode="cleanup"> |
---|
525 | <!-- move up iref elements --> |
---|
526 | <figure> |
---|
527 | <xsl:apply-templates select="@*" mode="cleanup" /> |
---|
528 | <xsl:apply-templates select=".//artwork//iref" mode="cleanup"/> |
---|
529 | <xsl:apply-templates select="iref|preamble|artwork|postamble" mode="cleanup" /> |
---|
530 | </figure> |
---|
531 | </xsl:template> |
---|
532 | |
---|
533 | <xsl:template match="artwork" mode="cleanup"> |
---|
534 | <xsl:variable name="content2"><xsl:apply-templates select="."/></xsl:variable> |
---|
535 | <xsl:variable name="content" select="translate($content2,' ─│┈┌┐└┘├┤',' -|+++++++')"/> |
---|
536 | <artwork> |
---|
537 | <xsl:apply-templates select="@*" mode="cleanup" /> |
---|
538 | <xsl:if test="starts-with(.,' ')"> |
---|
539 | <xsl:text> </xsl:text> |
---|
540 | <xsl:value-of select="@x:indent-with"/> |
---|
541 | </xsl:if> |
---|
542 | <xsl:choose> |
---|
543 | <xsl:when test="@x:indent-with!=''"> |
---|
544 | <xsl:call-template name="indent"> |
---|
545 | <xsl:with-param name="content" select="$content"/> |
---|
546 | <xsl:with-param name="with" select="@x:indent-with"/> |
---|
547 | </xsl:call-template> |
---|
548 | </xsl:when> |
---|
549 | <xsl:otherwise> |
---|
550 | <xsl:value-of select="$content"/> |
---|
551 | </xsl:otherwise> |
---|
552 | </xsl:choose> |
---|
553 | </artwork> |
---|
554 | </xsl:template> |
---|
555 | |
---|
556 | <xsl:template match="@x:indent-with" mode="cleanup"/> |
---|
557 | |
---|
558 | <xsl:template name="indent"> |
---|
559 | <xsl:param name="content"/> |
---|
560 | <xsl:param name="with"/> |
---|
561 | |
---|
562 | <xsl:value-of select="substring($content,1,1)"/> |
---|
563 | <xsl:if test="substring($content,1,1)=' '"> |
---|
564 | <xsl:value-of select="$with"/> |
---|
565 | </xsl:if> |
---|
566 | |
---|
567 | <xsl:choose> |
---|
568 | <xsl:when test="$content=''" /> |
---|
569 | <xsl:otherwise> |
---|
570 | <xsl:call-template name="indent"> |
---|
571 | <xsl:with-param name="content" select="substring($content,2)"/> |
---|
572 | <xsl:with-param name="with" select="$with"/> |
---|
573 | </xsl:call-template> |
---|
574 | </xsl:otherwise> |
---|
575 | </xsl:choose> |
---|
576 | |
---|
577 | </xsl:template> |
---|
578 | |
---|
579 | <!-- email repititions --> |
---|
580 | <xsl:template match="email" mode="cleanup"> |
---|
581 | <!-- combine in a single element --> |
---|
582 | <xsl:if test="not(preceding-sibling::email)"> |
---|
583 | <email> |
---|
584 | <xsl:for-each select="../email"> |
---|
585 | <xsl:value-of select="."/> |
---|
586 | <xsl:if test="position()!=last()"> |
---|
587 | <xsl:text>, </xsl:text> |
---|
588 | </xsl:if> |
---|
589 | </xsl:for-each> |
---|
590 | </email> |
---|
591 | </xsl:if> |
---|
592 | </xsl:template> |
---|
593 | |
---|
594 | <!-- markup inside cref --> |
---|
595 | <xsl:template match="cref//eref" mode="cleanup"> |
---|
596 | <xsl:text><</xsl:text> |
---|
597 | <xsl:value-of select="@target"/> |
---|
598 | <xsl:text>></xsl:text> |
---|
599 | </xsl:template> |
---|
600 | |
---|
601 | <!-- artwork extensions --> |
---|
602 | <xsl:template match="artwork/@x:extraction-note" mode="cleanup"/> |
---|
603 | |
---|
604 | <!-- list formatting --> |
---|
605 | <xsl:template match="list/@x:indent" mode="cleanup"/> |
---|
606 | |
---|
607 | <!-- referencing extensions --> |
---|
608 | <xsl:template match="iref/@x:for-anchor" mode="cleanup"/> |
---|
609 | |
---|
610 | <!-- table styles --> |
---|
611 | <xsl:template match="texttable/@style" mode="cleanup"/> |
---|
612 | |
---|
613 | <!-- anchor extensions --> |
---|
614 | <xsl:template match="preamble/@anchor" mode="cleanup"/> |
---|
615 | |
---|
616 | <!-- section numbering --> |
---|
617 | <xsl:template match="section/@x:fixed-section-number" mode="cleanup"/> |
---|
618 | |
---|
619 | <!-- GRRDL info stripped --> |
---|
620 | <xsl:template match="@grddl:transformation" mode="cleanup"/> |
---|
621 | |
---|
622 | <!-- maturity level stripped --> |
---|
623 | <xsl:template match="@x:maturity-level" mode="cleanup"/> |
---|
624 | |
---|
625 | <!-- RDF info stripped --> |
---|
626 | <xsl:template match="rdf:*" mode="cleanup"/> |
---|
627 | |
---|
628 | </xsl:transform> |
---|