]> git.argeo.org Git - gpl/argeo-suite.git/blob - org.argeo.app.core/src/org/argeo/app/docbook/db4-upgrade.xsl
Instrument image utils
[gpl/argeo-suite.git] / org.argeo.app.core / src / org / argeo / app / docbook / db4-upgrade.xsl
1 <?xml version="1.0"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:exsl="http://exslt.org/common"
4 xmlns:db = "http://docbook.org/ns/docbook"
5 xmlns:xlink="http://www.w3.org/1999/xlink"
6 exclude-result-prefixes="exsl db"
7 version="1.0">
8
9 <!--
10 # ======================================================================
11 # This file is part of DocBook V5.0CR5
12 #
13 # Copyright 2005 Norman Walsh, Sun Microsystems, Inc., and the
14 # Organization for the Advancement of Structured Information
15 # Standards (OASIS).
16 #
17 # Release: $Id: db4-upgrade.xsl 7660 2008-02-06 13:48:36Z nwalsh $
18 #
19 # Permission to use, copy, modify and distribute this stylesheet
20 # and its accompanying documentation for any purpose and without fee
21 # is hereby granted in perpetuity, provided that the above copyright
22 # notice and this paragraph appear in all copies. The copyright
23 # holders make no representation about the suitability of the schema
24 # for any purpose. It is provided "as is" without expressed or implied
25 # warranty.
26 #
27 # Please direct all questions, bug reports, or suggestions for changes
28 # to the docbook@lists.oasis-open.org mailing list. For more
29 # information, see http://www.oasis-open.org/docbook/.
30 #
31 # ======================================================================
32 -->
33
34 <xsl:variable name="version" select="'1.0'"/>
35
36 <xsl:output method="xml" encoding="utf-8" indent="no" omit-xml-declaration="yes"/>
37
38 <xsl:preserve-space elements="*"/>
39 <xsl:param name="rootid">
40 <xsl:choose>
41 <xsl:when test="/*/@id">
42 <xsl:value-of select="/*/@id"/>
43 </xsl:when>
44 <xsl:otherwise>
45 <xsl:text>UNKNOWN</xsl:text>
46 </xsl:otherwise>
47 </xsl:choose>
48 </xsl:param>
49
50 <xsl:param name="defaultDate" select="''"/>
51
52 <xsl:template match="/">
53 <xsl:variable name="converted">
54 <xsl:apply-templates/>
55 </xsl:variable>
56 <xsl:comment>
57 <xsl:text> Converted by db4-upgrade version </xsl:text>
58 <xsl:value-of select="$version"/>
59 <xsl:text> </xsl:text>
60 </xsl:comment>
61 <xsl:text>&#10;</xsl:text>
62 <xsl:apply-templates select="exsl:node-set($converted)/*" mode="addNS"/>
63 </xsl:template>
64
65 <xsl:template match="bookinfo|chapterinfo|articleinfo|artheader|appendixinfo
66 |blockinfo
67 |bibliographyinfo|glossaryinfo|indexinfo|setinfo
68 |setindexinfo
69 |sect1info|sect2info|sect3info|sect4info|sect5info
70 |sectioninfo
71 |refsect1info|refsect2info|refsect3info|refsectioninfo
72 |referenceinfo|partinfo"
73 priority="200">
74 <info>
75 <xsl:call-template name="copy.attributes"/>
76
77 <!-- titles can be inside or outside or both. fix that -->
78 <xsl:choose>
79 <xsl:when test="title and following-sibling::title">
80 <xsl:if test="title != following-sibling::title">
81 <xsl:call-template name="emit-message">
82 <xsl:with-param name="message">
83 <xsl:text>Check </xsl:text>
84 <xsl:value-of select="name(..)"/>
85 <xsl:text> title.</xsl:text>
86 </xsl:with-param>
87 </xsl:call-template>
88 </xsl:if>
89 <xsl:apply-templates select="title" mode="copy"/>
90 </xsl:when>
91 <xsl:when test="title">
92 <xsl:apply-templates select="title" mode="copy"/>
93 </xsl:when>
94 <xsl:when test="following-sibling::title">
95 <xsl:apply-templates select="following-sibling::title" mode="copy"/>
96 </xsl:when>
97 <xsl:otherwise>
98 <xsl:call-template name="emit-message">
99 <xsl:with-param name="message">
100 <xsl:text>Check </xsl:text>
101 <xsl:value-of select="name(..)"/>
102 <xsl:text>: no title.</xsl:text>
103 </xsl:with-param>
104 </xsl:call-template>
105 </xsl:otherwise>
106 </xsl:choose>
107
108 <xsl:choose>
109 <xsl:when test="titleabbrev and following-sibling::titleabbrev">
110 <xsl:if test="titleabbrev != following-sibling::titleabbrev">
111 <xsl:call-template name="emit-message">
112 <xsl:with-param name="message">
113 <xsl:text>Check </xsl:text>
114 <xsl:value-of select="name(..)"/>
115 <xsl:text> titleabbrev.</xsl:text>
116 </xsl:with-param>
117 </xsl:call-template>
118 </xsl:if>
119 <xsl:apply-templates select="titleabbrev" mode="copy"/>
120 </xsl:when>
121 <xsl:when test="titleabbrev">
122 <xsl:apply-templates select="titleabbrev" mode="copy"/>
123 </xsl:when>
124 <xsl:when test="following-sibling::titleabbrev">
125 <xsl:apply-templates select="following-sibling::titleabbrev" mode="copy"/>
126 </xsl:when>
127 </xsl:choose>
128
129 <xsl:choose>
130 <xsl:when test="subtitle and following-sibling::subtitle">
131 <xsl:if test="subtitle != following-sibling::subtitle">
132 <xsl:call-template name="emit-message">
133 <xsl:with-param name="message">
134 <xsl:text>Check </xsl:text>
135 <xsl:value-of select="name(..)"/>
136 <xsl:text> subtitle.</xsl:text>
137 </xsl:with-param>
138 </xsl:call-template>
139 </xsl:if>
140 <xsl:apply-templates select="subtitle" mode="copy"/>
141 </xsl:when>
142 <xsl:when test="subtitle">
143 <xsl:apply-templates select="subtitle" mode="copy"/>
144 </xsl:when>
145 <xsl:when test="following-sibling::subtitle">
146 <xsl:apply-templates select="following-sibling::subtitle" mode="copy"/>
147 </xsl:when>
148 </xsl:choose>
149
150 <xsl:apply-templates/>
151 </info>
152 </xsl:template>
153
154 <xsl:template match="objectinfo|prefaceinfo|refsynopsisdivinfo
155 |screeninfo|sidebarinfo"
156 priority="200">
157 <info>
158 <xsl:call-template name="copy.attributes"/>
159
160 <!-- titles can be inside or outside or both. fix that -->
161 <xsl:choose>
162 <xsl:when test="title and following-sibling::title">
163 <xsl:if test="title != following-sibling::title">
164 <xsl:call-template name="emit-message">
165 <xsl:with-param name="message">
166 <xsl:text>Check </xsl:text>
167 <xsl:value-of select="name(..)"/>
168 <xsl:text> title.</xsl:text>
169 </xsl:with-param>
170 </xsl:call-template>
171 </xsl:if>
172 <xsl:apply-templates select="title" mode="copy"/>
173 </xsl:when>
174 <xsl:when test="title">
175 <xsl:apply-templates select="title" mode="copy"/>
176 </xsl:when>
177 <xsl:when test="following-sibling::title">
178 <xsl:apply-templates select="following-sibling::title" mode="copy"/>
179 </xsl:when>
180 <xsl:otherwise>
181 <!-- it's ok if there's no title on these -->
182 </xsl:otherwise>
183 </xsl:choose>
184
185 <xsl:choose>
186 <xsl:when test="titleabbrev and following-sibling::titleabbrev">
187 <xsl:if test="titleabbrev != following-sibling::titleabbrev">
188 <xsl:call-template name="emit-message">
189 <xsl:with-param name="message">
190 <xsl:text>Check </xsl:text>
191 <xsl:value-of select="name(..)"/>
192 <xsl:text> titleabbrev.</xsl:text>
193 </xsl:with-param>
194 </xsl:call-template>
195 </xsl:if>
196 <xsl:apply-templates select="titleabbrev" mode="copy"/>
197 </xsl:when>
198 <xsl:when test="titleabbrev">
199 <xsl:apply-templates select="titleabbrev" mode="copy"/>
200 </xsl:when>
201 <xsl:when test="following-sibling::titleabbrev">
202 <xsl:apply-templates select="following-sibling::titleabbrev" mode="copy"/>
203 </xsl:when>
204 </xsl:choose>
205
206 <xsl:choose>
207 <xsl:when test="subtitle and following-sibling::subtitle">
208 <xsl:if test="subtitle != following-sibling::subtitle">
209 <xsl:call-template name="emit-message">
210 <xsl:with-param name="message">
211 <xsl:text>Check </xsl:text>
212 <xsl:value-of select="name(..)"/>
213 <xsl:text> subtitle.</xsl:text>
214 </xsl:with-param>
215 </xsl:call-template>
216 </xsl:if>
217 <xsl:apply-templates select="subtitle" mode="copy"/>
218 </xsl:when>
219 <xsl:when test="subtitle">
220 <xsl:apply-templates select="subtitle" mode="copy"/>
221 </xsl:when>
222 <xsl:when test="following-sibling::subtitle">
223 <xsl:apply-templates select="following-sibling::subtitle" mode="copy"/>
224 </xsl:when>
225 </xsl:choose>
226
227 <xsl:apply-templates/>
228 </info>
229 </xsl:template>
230
231 <xsl:template match="refentryinfo"
232 priority="200">
233 <info>
234 <xsl:call-template name="copy.attributes"/>
235
236 <!-- titles can be inside or outside or both. fix that -->
237 <xsl:if test="title">
238 <xsl:call-template name="emit-message">
239 <xsl:with-param name="message">
240 <xsl:text>Discarding title from refentryinfo!</xsl:text>
241 </xsl:with-param>
242 </xsl:call-template>
243 </xsl:if>
244
245 <xsl:if test="titleabbrev">
246 <xsl:call-template name="emit-message">
247 <xsl:with-param name="message">
248 <xsl:text>Discarding titleabbrev from refentryinfo!</xsl:text>
249 </xsl:with-param>
250 </xsl:call-template>
251 </xsl:if>
252
253 <xsl:if test="subtitle">
254 <xsl:call-template name="emit-message">
255 <xsl:with-param name="message">
256 <xsl:text>Discarding subtitle from refentryinfo!</xsl:text>
257 </xsl:with-param>
258 </xsl:call-template>
259 </xsl:if>
260
261 <xsl:apply-templates/>
262 </info>
263 </xsl:template>
264
265 <xsl:template match="refmiscinfo"
266 priority="200">
267 <refmiscinfo>
268 <xsl:call-template name="copy.attributes">
269 <xsl:with-param name="suppress" select="'class'"/>
270 </xsl:call-template>
271 <xsl:if test="@class">
272 <xsl:choose>
273 <xsl:when test="@class = 'source'
274 or @class = 'version'
275 or @class = 'manual'
276 or @class = 'sectdesc'
277 or @class = 'software'">
278 <xsl:attribute name="class">
279 <xsl:value-of select="@class"/>
280 </xsl:attribute>
281 </xsl:when>
282 <xsl:otherwise>
283 <xsl:attribute name="class">
284 <xsl:value-of select="'other'"/>
285 </xsl:attribute>
286 <xsl:attribute name="otherclass">
287 <xsl:value-of select="@class"/>
288 </xsl:attribute>
289 </xsl:otherwise>
290 </xsl:choose>
291 </xsl:if>
292 <xsl:apply-templates/>
293 </refmiscinfo>
294 </xsl:template>
295
296 <xsl:template match="corpauthor" priority="200">
297 <author>
298 <xsl:call-template name="copy.attributes"/>
299 <orgname>
300 <xsl:apply-templates/>
301 </orgname>
302 </author>
303 </xsl:template>
304
305 <xsl:template match="corpname" priority="200">
306 <orgname>
307 <xsl:call-template name="copy.attributes"/>
308 <xsl:apply-templates/>
309 </orgname>
310 </xsl:template>
311
312 <xsl:template match="author[not(personname)]|editor[not(personname)]|othercredit[not(personname)]" priority="200">
313 <xsl:copy>
314 <xsl:call-template name="copy.attributes"/>
315 <personname>
316 <xsl:apply-templates select="honorific|firstname|surname|othername|lineage"/>
317 </personname>
318 <xsl:apply-templates select="*[not(self::honorific|self::firstname|self::surname
319 |self::othername|self::lineage)]"/>
320 </xsl:copy>
321 </xsl:template>
322
323 <xsl:template match="address|programlisting|screen|funcsynopsisinfo
324 |classsynopsisinfo|literallayout" priority="200">
325 <xsl:copy>
326 <xsl:call-template name="copy.attributes">
327 <xsl:with-param name="suppress" select="'format'"/>
328 </xsl:call-template>
329 <xsl:apply-templates/>
330 </xsl:copy>
331 </xsl:template>
332
333 <xsl:template match="productname[@class]" priority="200">
334 <xsl:call-template name="emit-message">
335 <xsl:with-param name="message">
336 <xsl:text>Dropping class attribute from productname</xsl:text>
337 </xsl:with-param>
338 </xsl:call-template>
339 <xsl:copy>
340 <xsl:call-template name="copy.attributes">
341 <xsl:with-param name="suppress" select="'class'"/>
342 </xsl:call-template>
343 <xsl:apply-templates/>
344 </xsl:copy>
345 </xsl:template>
346
347 <xsl:template match="dedication|preface|chapter|appendix|part|partintro
348 |article|bibliography|glossary|glossdiv|index
349 |reference[not(referenceinfo)]
350 |book" priority="200">
351 <xsl:choose>
352 <xsl:when test="not(dedicationinfo|prefaceinfo|chapterinfo
353 |appendixinfo|partinfo
354 |articleinfo|artheader|bibliographyinfo
355 |glossaryinfo|indexinfo
356 |bookinfo)">
357 <xsl:copy>
358 <xsl:call-template name="copy.attributes"/>
359 <xsl:if test="title|subtitle|titleabbrev">
360 <info>
361 <xsl:apply-templates select="title" mode="copy"/>
362 <xsl:apply-templates select="titleabbrev" mode="copy"/>
363 <xsl:apply-templates select="subtitle" mode="copy"/>
364 <xsl:apply-templates select="abstract" mode="copy"/>
365 </info>
366 </xsl:if>
367 <xsl:apply-templates/>
368 </xsl:copy>
369 </xsl:when>
370 <xsl:otherwise>
371 <xsl:copy>
372 <xsl:call-template name="copy.attributes"/>
373 <xsl:apply-templates/>
374 </xsl:copy>
375 </xsl:otherwise>
376 </xsl:choose>
377 </xsl:template>
378
379 <xsl:template match="formalpara|figure|table[tgroup]|example|blockquote
380 |caution|important|note|warning|tip
381 |bibliodiv|glossarydiv|indexdiv
382 |orderedlist|itemizedlist|variablelist|procedure
383 |task|tasksummary|taskprerequisites|taskrelated
384 |sidebar"
385 priority="200">
386 <xsl:choose>
387 <xsl:when test="blockinfo">
388 <xsl:copy>
389 <xsl:call-template name="copy.attributes"/>
390 <xsl:apply-templates/>
391 </xsl:copy>
392 </xsl:when>
393 <xsl:otherwise>
394 <xsl:copy>
395 <xsl:call-template name="copy.attributes"/>
396
397 <xsl:if test="title|titleabbrev|subtitle">
398 <info>
399 <xsl:apply-templates select="title" mode="copy"/>
400 <xsl:apply-templates select="titleabbrev" mode="copy"/>
401 <xsl:apply-templates select="subtitle" mode="copy"/>
402 </info>
403 </xsl:if>
404
405 <xsl:apply-templates/>
406 </xsl:copy>
407 </xsl:otherwise>
408 </xsl:choose>
409 </xsl:template>
410
411 <xsl:template match="equation" priority="200">
412 <xsl:choose>
413 <xsl:when test="not(title)">
414 <xsl:call-template name="emit-message">
415 <xsl:with-param
416 name="message"
417 >Convert equation without title to informal equation.</xsl:with-param>
418 </xsl:call-template>
419 <informalequation>
420 <xsl:call-template name="copy.attributes"/>
421 <xsl:apply-templates/>
422 </informalequation>
423 </xsl:when>
424 <xsl:when test="blockinfo">
425 <xsl:copy>
426 <xsl:call-template name="copy.attributes"/>
427 <xsl:apply-templates/>
428 </xsl:copy>
429 </xsl:when>
430 <xsl:otherwise>
431 <xsl:copy>
432 <xsl:call-template name="copy.attributes"/>
433 <info>
434 <xsl:apply-templates select="title" mode="copy"/>
435 <xsl:apply-templates select="titleabbrev" mode="copy"/>
436 <xsl:apply-templates select="subtitle" mode="copy"/>
437 </info>
438 <xsl:apply-templates/>
439 </xsl:copy>
440 </xsl:otherwise>
441 </xsl:choose>
442 </xsl:template>
443
444 <xsl:template match="sect1|sect2|sect3|sect4|sect5|section"
445 priority="200">
446 <section>
447 <xsl:call-template name="copy.attributes"/>
448
449 <xsl:if test="not(sect1info|sect2info|sect3info|sect4info|sect5info|sectioninfo)">
450 <info>
451 <xsl:apply-templates select="title" mode="copy"/>
452 <xsl:apply-templates select="titleabbrev" mode="copy"/>
453 <xsl:apply-templates select="subtitle" mode="copy"/>
454 <xsl:apply-templates select="abstract" mode="copy"/>
455 </info>
456 </xsl:if>
457 <xsl:apply-templates/>
458 </section>
459 </xsl:template>
460
461 <xsl:template match="simplesect"
462 priority="200">
463 <simplesect>
464 <xsl:call-template name="copy.attributes"/>
465 <info>
466 <xsl:apply-templates select="title" mode="copy"/>
467 <xsl:apply-templates select="titleabbrev" mode="copy"/>
468 <xsl:apply-templates select="subtitle" mode="copy"/>
469 <xsl:apply-templates select="abstract" mode="copy"/>
470 </info>
471 <xsl:apply-templates/>
472 </simplesect>
473 </xsl:template>
474
475 <xsl:template match="refsect1|refsect2|refsect3|refsection" priority="200">
476 <refsection>
477 <xsl:call-template name="copy.attributes"/>
478
479 <xsl:if test="not(refsect1info|refsect2info|refsect3info|refsectioninfo)">
480 <info>
481 <xsl:apply-templates select="title" mode="copy"/>
482 <xsl:apply-templates select="titleabbrev" mode="copy"/>
483 <xsl:apply-templates select="subtitle" mode="copy"/>
484 <xsl:apply-templates select="abstract" mode="copy"/>
485 </info>
486 </xsl:if>
487 <xsl:apply-templates/>
488 </refsection>
489 </xsl:template>
490
491 <xsl:template match="imagedata|videodata|audiodata|textdata" priority="200">
492 <xsl:copy>
493 <xsl:call-template name="copy.attributes">
494 <xsl:with-param name="suppress" select="'srccredit'"/>
495 </xsl:call-template>
496 <xsl:if test="@srccredit">
497 <xsl:call-template name="emit-message">
498 <xsl:with-param name="message">
499 <xsl:text>Check conversion of srccredit </xsl:text>
500 <xsl:text>(othercredit="srccredit").</xsl:text>
501 </xsl:with-param>
502 </xsl:call-template>
503 <info>
504 <othercredit class="other" otherclass="srccredit">
505 <orgname>???</orgname>
506 <contrib>
507 <xsl:value-of select="@srccredit"/>
508 </contrib>
509 </othercredit>
510 </info>
511 </xsl:if>
512 </xsl:copy>
513 </xsl:template>
514
515 <xsl:template match="sgmltag" priority="200">
516 <tag>
517 <xsl:call-template name="copy.attributes"/>
518 <xsl:if test="@class = 'sgmlcomment'">
519 <xsl:attribute name="class">comment</xsl:attribute>
520 </xsl:if>
521 <xsl:apply-templates/>
522 </tag>
523 </xsl:template>
524
525 <xsl:template match="inlinegraphic[@format='linespecific']" priority="210">
526 <textobject>
527 <textdata>
528 <xsl:call-template name="copy.attributes"/>
529 </textdata>
530 </textobject>
531 </xsl:template>
532
533 <xsl:template match="inlinegraphic" priority="200">
534 <inlinemediaobject>
535 <imageobject>
536 <imagedata>
537 <xsl:call-template name="copy.attributes"/>
538 </imagedata>
539 </imageobject>
540 </inlinemediaobject>
541 </xsl:template>
542
543 <xsl:template match="graphic[@format='linespecific']" priority="210">
544 <mediaobject>
545 <textobject>
546 <textdata>
547 <xsl:call-template name="copy.attributes"/>
548 </textdata>
549 </textobject>
550 </mediaobject>
551 </xsl:template>
552
553 <xsl:template match="graphic" priority="200">
554 <mediaobject>
555 <imageobject>
556 <imagedata>
557 <xsl:call-template name="copy.attributes"/>
558 </imagedata>
559 </imageobject>
560 </mediaobject>
561 </xsl:template>
562
563 <xsl:template match="pubsnumber" priority="200">
564 <biblioid class="pubsnumber">
565 <xsl:call-template name="copy.attributes"/>
566 <xsl:apply-templates/>
567 </biblioid>
568 </xsl:template>
569
570 <xsl:template match="invpartnumber" priority="200">
571 <xsl:call-template name="emit-message">
572 <xsl:with-param name="message">
573 <xsl:text>Converting invpartnumber to biblioid otherclass="invpartnumber".</xsl:text>
574 </xsl:with-param>
575 </xsl:call-template>
576 <biblioid class="other" otherclass="invpartnumber">
577 <xsl:call-template name="copy.attributes"/>
578 <xsl:apply-templates/>
579 </biblioid>
580 </xsl:template>
581
582 <xsl:template match="contractsponsor" priority="200">
583 <xsl:variable name="contractnum"
584 select="preceding-sibling::contractnum|following-sibling::contractnum"/>
585
586 <xsl:call-template name="emit-message">
587 <xsl:with-param name="message">
588 <xsl:text>Converting contractsponsor to othercredit="contractsponsor".</xsl:text>
589 </xsl:with-param>
590 </xsl:call-template>
591
592 <othercredit class="other" otherclass="contractsponsor">
593 <orgname>
594 <xsl:call-template name="copy.attributes"/>
595 <xsl:apply-templates/>
596 </orgname>
597 <xsl:for-each select="$contractnum">
598 <contrib role="contractnum">
599 <xsl:apply-templates select="node()"/>
600 </contrib>
601 </xsl:for-each>
602 </othercredit>
603 </xsl:template>
604
605 <xsl:template match="contractnum" priority="200">
606 <xsl:if test="not(preceding-sibling::contractsponsor
607 |following-sibling::contractsponsor)
608 and not(preceding-sibling::contractnum)">
609 <xsl:call-template name="emit-message">
610 <xsl:with-param name="message">
611 <xsl:text>Converting contractnum to othercredit="contractnum".</xsl:text>
612 </xsl:with-param>
613 </xsl:call-template>
614
615 <othercredit class="other" otherclass="contractnum">
616 <orgname>???</orgname>
617 <xsl:for-each select="self::contractnum
618 |preceding-sibling::contractnum
619 |following-sibling::contractnum">
620 <contrib>
621 <xsl:apply-templates select="node()"/>
622 </contrib>
623 </xsl:for-each>
624 </othercredit>
625 </xsl:if>
626 </xsl:template>
627
628 <xsl:template match="isbn|issn" priority="200">
629 <biblioid class="{local-name(.)}">
630 <xsl:call-template name="copy.attributes"/>
631 <xsl:apply-templates/>
632 </biblioid>
633 </xsl:template>
634
635 <xsl:template match="biblioid[count(*) = 1
636 and ulink
637 and normalize-space(text()) = '']" priority="200">
638 <biblioid xlink:href="{ulink/@url}">
639 <xsl:call-template name="copy.attributes"/>
640 <xsl:apply-templates select="ulink/node()"/>
641 </biblioid>
642 </xsl:template>
643
644 <xsl:template match="authorblurb" priority="200">
645 <personblurb>
646 <xsl:call-template name="copy.attributes"/>
647 <xsl:apply-templates/>
648 </personblurb>
649 </xsl:template>
650
651 <xsl:template match="collabname" priority="200">
652 <xsl:call-template name="emit-message">
653 <xsl:with-param name="message">
654 <xsl:text>Check conversion of collabname </xsl:text>
655 <xsl:text>(orgname role="collabname").</xsl:text>
656 </xsl:with-param>
657 </xsl:call-template>
658 <orgname role="collabname">
659 <xsl:call-template name="copy.attributes"/>
660 <xsl:apply-templates/>
661 </orgname>
662 </xsl:template>
663
664 <xsl:template match="modespec" priority="200">
665 <xsl:call-template name="emit-message">
666 <xsl:with-param name="message">
667 <xsl:text>Discarding modespec (</xsl:text>
668 <xsl:value-of select="."/>
669 <xsl:text>).</xsl:text>
670 </xsl:with-param>
671 </xsl:call-template>
672 </xsl:template>
673
674 <xsl:template match="mediaobjectco" priority="200">
675 <mediaobject>
676 <xsl:copy-of select="@*"/>
677 <xsl:apply-templates/>
678 </mediaobject>
679 </xsl:template>
680
681 <xsl:template match="remark" priority="200">
682 <!-- get rid of any embedded markup -->
683 <remark>
684 <xsl:copy-of select="@*"/>
685 <xsl:value-of select="."/>
686 </remark>
687 </xsl:template>
688
689 <xsl:template match="biblioentry/title
690 |bibliomset/title
691 |biblioset/title
692 |bibliomixed/title" priority="400">
693 <citetitle>
694 <xsl:copy-of select="@*"/>
695 <xsl:apply-templates/>
696 </citetitle>
697 </xsl:template>
698
699 <xsl:template match="biblioentry/titleabbrev|biblioentry/subtitle
700 |bibliomset/titleabbrev|bibliomset/subtitle
701 |biblioset/titleabbrev|biblioset/subtitle
702 |bibliomixed/titleabbrev|bibliomixed/subtitle"
703 priority="400">
704 <xsl:copy>
705 <xsl:copy-of select="@*"/>
706 <xsl:apply-templates/>
707 </xsl:copy>
708 </xsl:template>
709
710 <xsl:template match="biblioentry/contrib
711 |bibliomset/contrib
712 |bibliomixed/contrib" priority="200">
713 <xsl:call-template name="emit-message">
714 <xsl:with-param name="message">
715 <xsl:text>Check conversion of contrib </xsl:text>
716 <xsl:text>(othercontrib="contrib").</xsl:text>
717 </xsl:with-param>
718 </xsl:call-template>
719 <othercredit class="other" otherclass="contrib">
720 <orgname>???</orgname>
721 <contrib>
722 <xsl:call-template name="copy.attributes"/>
723 <xsl:apply-templates/>
724 </contrib>
725 </othercredit>
726 </xsl:template>
727
728 <xsl:template match="link" priority="200">
729 <xsl:copy>
730 <xsl:call-template name="copy.attributes"/>
731 <xsl:apply-templates/>
732 </xsl:copy>
733 </xsl:template>
734
735 <xsl:template match="ulink" priority="200">
736 <xsl:choose>
737 <xsl:when test="node()">
738 <xsl:call-template name="emit-message">
739 <xsl:with-param name="message">
740 <xsl:text>Converting ulink to link.</xsl:text>
741 </xsl:with-param>
742 </xsl:call-template>
743
744 <link xlink:href="{@url}">
745 <xsl:call-template name="copy.attributes">
746 <xsl:with-param name="suppress" select="'url'"/>
747 </xsl:call-template>
748 <xsl:apply-templates/>
749 </link>
750 </xsl:when>
751 <xsl:otherwise>
752 <xsl:call-template name="emit-message">
753 <xsl:with-param name="message">
754 <xsl:text>Converting ulink to uri.</xsl:text>
755 </xsl:with-param>
756 </xsl:call-template>
757
758 <uri xlink:href="{@url}">
759 <xsl:call-template name="copy.attributes">
760 <xsl:with-param name="suppress" select="'url'"/>
761 </xsl:call-template>
762 <xsl:value-of select="@url"/>
763 </uri>
764 </xsl:otherwise>
765 </xsl:choose>
766 </xsl:template>
767
768 <xsl:template match="olink" priority="200">
769 <xsl:if test="@linkmode">
770 <xsl:call-template name="emit-message">
771 <xsl:with-param name="message">
772 <xsl:text>Discarding linkmode on olink.</xsl:text>
773 </xsl:with-param>
774 </xsl:call-template>
775 </xsl:if>
776
777 <xsl:choose>
778 <xsl:when test="@targetdocent">
779 <xsl:call-template name="emit-message">
780 <xsl:with-param name="message">
781 <xsl:text>Converting olink targetdocent to targetdoc.</xsl:text>
782 </xsl:with-param>
783 </xsl:call-template>
784
785 <olink targetdoc="{unparsed-entity-uri(@targetdocent)}">
786 <xsl:for-each select="@*">
787 <xsl:if test="name(.) != 'targetdocent'
788 and name(.) != 'linkmode'">
789 <xsl:copy/>
790 </xsl:if>
791 </xsl:for-each>
792 <xsl:apply-templates/>
793 </olink>
794 </xsl:when>
795 <xsl:otherwise>
796 <olink>
797 <xsl:for-each select="@*">
798 <xsl:if test="name(.) != 'linkmode'">
799 <xsl:copy/>
800 </xsl:if>
801 </xsl:for-each>
802 <xsl:apply-templates/>
803 </olink>
804 </xsl:otherwise>
805 </xsl:choose>
806 </xsl:template>
807
808 <xsl:template match="biblioentry/firstname
809 |biblioentry/surname
810 |biblioentry/othername
811 |biblioentry/lineage
812 |biblioentry/honorific
813 |bibliomset/firstname
814 |bibliomset/surname
815 |bibliomset/othername
816 |bibliomset/lineage
817 |bibliomset/honorific" priority="200">
818 <xsl:choose>
819 <xsl:when test="preceding-sibling::firstname
820 |preceding-sibling::surname
821 |preceding-sibling::othername
822 |preceding-sibling::lineage
823 |preceding-sibling::honorific">
824 <!-- nop -->
825 </xsl:when>
826 <xsl:otherwise>
827 <personname>
828 <xsl:apply-templates select="../firstname
829 |../surname
830 |../othername
831 |../lineage
832 |../honorific" mode="copy"/>
833 </personname>
834 </xsl:otherwise>
835 </xsl:choose>
836 </xsl:template>
837
838 <xsl:template match="areaset" priority="200">
839 <xsl:copy>
840 <xsl:call-template name="copy.attributes">
841 <xsl:with-param name="suppress" select="'coords'"/>
842 </xsl:call-template>
843 <xsl:apply-templates/>
844 </xsl:copy>
845 </xsl:template>
846
847 <xsl:template match="date|pubdate" priority="200">
848 <xsl:variable name="rp1" select="substring-before(normalize-space(.), ' ')"/>
849 <xsl:variable name="rp2"
850 select="substring-before(substring-after(normalize-space(.), ' '),
851 ' ')"/>
852 <xsl:variable name="rp3"
853 select="substring-after(substring-after(normalize-space(.), ' '), ' ')"/>
854
855 <xsl:variable name="p1">
856 <xsl:choose>
857 <xsl:when test="contains($rp1, ',')">
858 <xsl:value-of select="substring-before($rp1, ',')"/>
859 </xsl:when>
860 <xsl:otherwise>
861 <xsl:value-of select="$rp1"/>
862 </xsl:otherwise>
863 </xsl:choose>
864 </xsl:variable>
865
866 <xsl:variable name="p2">
867 <xsl:choose>
868 <xsl:when test="contains($rp2, ',')">
869 <xsl:value-of select="substring-before($rp2, ',')"/>
870 </xsl:when>
871 <xsl:otherwise>
872 <xsl:value-of select="$rp2"/>
873 </xsl:otherwise>
874 </xsl:choose>
875 </xsl:variable>
876
877 <xsl:variable name="p3">
878 <xsl:choose>
879 <xsl:when test="contains($rp3, ',')">
880 <xsl:value-of select="substring-before($rp3, ',')"/>
881 </xsl:when>
882 <xsl:otherwise>
883 <xsl:value-of select="$rp3"/>
884 </xsl:otherwise>
885 </xsl:choose>
886 </xsl:variable>
887
888 <xsl:variable name="date">
889 <xsl:choose>
890 <xsl:when test="string($p1+1) != 'NaN' and string($p3+1) != 'NaN'">
891 <xsl:choose>
892 <xsl:when test="$p2 = 'Jan' or $p2 = 'January'">
893 <xsl:number value="$p3" format="0001"/>
894 <xsl:text>-01-</xsl:text>
895 <xsl:number value="$p1" format="01"/>
896 </xsl:when>
897 <xsl:when test="$p2 = 'Feb' or $p2 = 'February'">
898 <xsl:number value="$p3" format="0001"/>
899 <xsl:text>-02-</xsl:text>
900 <xsl:number value="$p1" format="01"/>
901 </xsl:when>
902 <xsl:when test="$p2 = 'Mar' or $p2 = 'March'">
903 <xsl:number value="$p3" format="0001"/>
904 <xsl:text>-03-</xsl:text>
905 <xsl:number value="$p1" format="01"/>
906 </xsl:when>
907 <xsl:when test="$p2 = 'Apr' or $p2 = 'April'">
908 <xsl:number value="$p3" format="0001"/>
909 <xsl:text>-04-</xsl:text>
910 <xsl:number value="$p1" format="01"/>
911 </xsl:when>
912 <xsl:when test="$p2 = 'May'">
913 <xsl:number value="$p3" format="0001"/>
914 <xsl:text>-05-</xsl:text>
915 <xsl:number value="$p1" format="01"/>
916 </xsl:when>
917 <xsl:when test="$p2 = 'Jun' or $p2 = 'June'">
918 <xsl:number value="$p3" format="0001"/>
919 <xsl:text>-06-</xsl:text>
920 <xsl:number value="$p1" format="01"/>
921 </xsl:when>
922 <xsl:when test="$p2 = 'Jul' or $p2 = 'July'">
923 <xsl:number value="$p3" format="0001"/>
924 <xsl:text>-07-</xsl:text>
925 <xsl:number value="$p1" format="01"/>
926 </xsl:when>
927 <xsl:when test="$p2 = 'Aug' or $p2 = 'August'">
928 <xsl:number value="$p3" format="0001"/>
929 <xsl:text>-08-</xsl:text>
930 <xsl:number value="$p1" format="01"/>
931 </xsl:when>
932 <xsl:when test="$p2 = 'Sep' or $p2 = 'September'">
933 <xsl:number value="$p3" format="0001"/>
934 <xsl:text>-09-</xsl:text>
935 <xsl:number value="$p1" format="01"/>
936 </xsl:when>
937 <xsl:when test="$p2 = 'Oct' or $p2 = 'October'">
938 <xsl:number value="$p3" format="0001"/>
939 <xsl:text>-10-</xsl:text>
940 <xsl:number value="$p1" format="01"/>
941 </xsl:when>
942 <xsl:when test="$p2 = 'Nov' or $p2 = 'November'">
943 <xsl:number value="$p3" format="0001"/>
944 <xsl:text>-11-</xsl:text>
945 <xsl:number value="$p1" format="01"/>
946 </xsl:when>
947 <xsl:when test="$p2 = 'Dec' or $p2 = 'December'">
948 <xsl:number value="$p3" format="0001"/>
949 <xsl:text>-12-</xsl:text>
950 <xsl:number value="$p1" format="01"/>
951 </xsl:when>
952 <xsl:otherwise>
953 <xsl:apply-templates/>
954 </xsl:otherwise>
955 </xsl:choose>
956 </xsl:when>
957 <xsl:when test="string($p2+1) != 'NaN' and string($p3+1) != 'NaN'">
958 <xsl:choose>
959 <xsl:when test="$p1 = 'Jan' or $p1 = 'January'">
960 <xsl:number value="$p3" format="0001"/>
961 <xsl:text>-01-</xsl:text>
962 <xsl:number value="$p2" format="01"/>
963 </xsl:when>
964 <xsl:when test="$p1 = 'Feb' or $p1 = 'February'">
965 <xsl:number value="$p3" format="0001"/>
966 <xsl:text>-02-</xsl:text>
967 <xsl:number value="$p2" format="01"/>
968 </xsl:when>
969 <xsl:when test="$p1 = 'Mar' or $p1 = 'March'">
970 <xsl:number value="$p3" format="0001"/>
971 <xsl:text>-03-</xsl:text>
972 <xsl:number value="$p2" format="01"/>
973 </xsl:when>
974 <xsl:when test="$p1 = 'Apr' or $p1 = 'April'">
975 <xsl:number value="$p3" format="0001"/>
976 <xsl:text>-04-</xsl:text>
977 <xsl:number value="$p2" format="01"/>
978 </xsl:when>
979 <xsl:when test="$p1 = 'May'">
980 <xsl:number value="$p3" format="0001"/>
981 <xsl:text>-05-</xsl:text>
982 <xsl:number value="$p2" format="01"/>
983 </xsl:when>
984 <xsl:when test="$p1 = 'Jun' or $p1 = 'June'">
985 <xsl:number value="$p3" format="0001"/>
986 <xsl:text>-06-</xsl:text>
987 <xsl:number value="$p2" format="01"/>
988 </xsl:when>
989 <xsl:when test="$p1 = 'Jul' or $p1 = 'July'">
990 <xsl:number value="$p3" format="0001"/>
991 <xsl:text>-07-</xsl:text>
992 <xsl:number value="$p2" format="01"/>
993 </xsl:when>
994 <xsl:when test="$p1 = 'Aug' or $p1 = 'August'">
995 <xsl:number value="$p3" format="0001"/>
996 <xsl:text>-08-</xsl:text>
997 <xsl:number value="$p2" format="01"/>
998 </xsl:when>
999 <xsl:when test="$p1 = 'Sep' or $p1 = 'September'">
1000 <xsl:number value="$p3" format="0001"/>
1001 <xsl:text>-09-</xsl:text>
1002 <xsl:number value="$p2" format="01"/>
1003 </xsl:when>
1004 <xsl:when test="$p1 = 'Oct' or $p1 = 'October'">
1005 <xsl:number value="$p3" format="0001"/>
1006 <xsl:text>-10-</xsl:text>
1007 <xsl:number value="$p2" format="01"/>
1008 </xsl:when>
1009 <xsl:when test="$p1 = 'Nov' or $p1 = 'November'">
1010 <xsl:number value="$p3" format="0001"/>
1011 <xsl:text>-11-</xsl:text>
1012 <xsl:number value="$p2" format="01"/>
1013 </xsl:when>
1014 <xsl:when test="$p1 = 'Dec' or $p1 = 'December'">
1015 <xsl:number value="$p3" format="0001"/>
1016 <xsl:text>-12-</xsl:text>
1017 <xsl:number value="$p2" format="01"/>
1018 </xsl:when>
1019 <xsl:otherwise>
1020 <xsl:apply-templates/>
1021 </xsl:otherwise>
1022 </xsl:choose>
1023 </xsl:when>
1024 <xsl:otherwise>
1025 <xsl:apply-templates/>
1026 </xsl:otherwise>
1027 </xsl:choose>
1028 </xsl:variable>
1029
1030 <xsl:choose>
1031 <xsl:when test="normalize-space($date) != normalize-space(.)">
1032 <xsl:call-template name="emit-message">
1033 <xsl:with-param name="message">
1034 <xsl:text>Converted </xsl:text>
1035 <xsl:value-of select="normalize-space(.)"/>
1036 <xsl:text> into </xsl:text>
1037 <xsl:value-of select="$date"/>
1038 <xsl:text> for </xsl:text>
1039 <xsl:value-of select="name(.)"/>
1040 </xsl:with-param>
1041 </xsl:call-template>
1042
1043 <xsl:copy>
1044 <xsl:copy-of select="@*"/>
1045 <xsl:value-of select="$date"/>
1046 </xsl:copy>
1047 </xsl:when>
1048
1049 <xsl:when test="$defaultDate != ''">
1050 <xsl:call-template name="emit-message">
1051 <xsl:with-param name="message">
1052 <xsl:text>Unparseable date: </xsl:text>
1053 <xsl:value-of select="normalize-space(.)"/>
1054 <xsl:text> in </xsl:text>
1055 <xsl:value-of select="name(.)"/>
1056 <xsl:text> (Using default: </xsl:text>
1057 <xsl:value-of select="$defaultDate"/>
1058 <xsl:text>)</xsl:text>
1059 </xsl:with-param>
1060 </xsl:call-template>
1061
1062 <xsl:copy>
1063 <xsl:copy-of select="@*"/>
1064 <xsl:copy-of select="$defaultDate"/>
1065 <xsl:comment>
1066 <xsl:value-of select="."/>
1067 </xsl:comment>
1068 </xsl:copy>
1069 </xsl:when>
1070
1071 <xsl:otherwise>
1072 <!-- these don't really matter anymore
1073 <xsl:call-template name="emit-message">
1074 <xsl:with-param name="message">
1075 <xsl:text>Unparseable date: </xsl:text>
1076 <xsl:value-of select="normalize-space(.)"/>
1077 <xsl:text> in </xsl:text>
1078 <xsl:value-of select="name(.)"/>
1079 </xsl:with-param>
1080 </xsl:call-template>
1081 -->
1082 <xsl:copy>
1083 <xsl:copy-of select="@*"/>
1084 <xsl:apply-templates/>
1085 </xsl:copy>
1086 </xsl:otherwise>
1087 </xsl:choose>
1088 </xsl:template>
1089
1090 <xsl:template match="title|subtitle|titleabbrev" priority="300">
1091 <!-- nop -->
1092 </xsl:template>
1093
1094 <xsl:template match="abstract" priority="300">
1095 <xsl:if test="not(contains(name(parent::*),'info'))">
1096 <xsl:call-template name="emit-message">
1097 <xsl:with-param name="message">
1098 <xsl:text>Check abstract; moved into info correctly?</xsl:text>
1099 </xsl:with-param>
1100 </xsl:call-template>
1101 </xsl:if>
1102 </xsl:template>
1103
1104 <xsl:template match="indexterm">
1105 <!-- don't copy the defaulted significance='normal' attribute -->
1106 <indexterm>
1107 <xsl:call-template name="copy.attributes">
1108 <xsl:with-param name="suppress">
1109 <xsl:if test="@significance = 'normal'">significance</xsl:if>
1110 </xsl:with-param>
1111 </xsl:call-template>
1112 <xsl:apply-templates/>
1113 </indexterm>
1114 </xsl:template>
1115
1116 <xsl:template match="ackno" priority="200">
1117 <acknowledgements>
1118 <xsl:copy-of select="@*"/>
1119 <para>
1120 <xsl:apply-templates/>
1121 </para>
1122 </acknowledgements>
1123 </xsl:template>
1124
1125 <xsl:template match="lot|lotentry|tocback|tocchap|tocfront|toclevel1|
1126 toclevel2|toclevel3|toclevel4|toclevel5|tocpart" priority="200">
1127 <tocdiv>
1128 <xsl:copy-of select="@*"/>
1129 <xsl:apply-templates/>
1130 </tocdiv>
1131 </xsl:template>
1132
1133 <xsl:template match="action" priority="200">
1134 <phrase remap="action">
1135 <xsl:call-template name="copy.attributes"/>
1136 <xsl:apply-templates/>
1137 </phrase>
1138 </xsl:template>
1139
1140 <xsl:template match="beginpage" priority="200">
1141 <xsl:comment> beginpage pagenum=<xsl:value-of select="@pagenum"/> </xsl:comment>
1142 <xsl:call-template name="emit-message">
1143 <xsl:with-param name="message">
1144 <xsl:text>Replacing beginpage with comment</xsl:text>
1145 </xsl:with-param>
1146 </xsl:call-template>
1147 </xsl:template>
1148
1149 <xsl:template match="structname|structfield" priority="200">
1150 <varname remap="{local-name(.)}">
1151 <xsl:call-template name="copy.attributes"/>
1152 <xsl:apply-templates/>
1153 </varname>
1154 </xsl:template>
1155
1156 <!-- ====================================================================== -->
1157
1158 <!-- 6 Feb 2008, ndw changed mode=copy so that it only copies the first level,
1159 then it switches back to "normal" mode so that other rewriting templates
1160 catch embedded fixes -->
1161
1162 <!--
1163 <xsl:template match="ulink" priority="200" mode="copy">
1164 <xsl:choose>
1165 <xsl:when test="node()">
1166 <xsl:call-template name="emit-message">
1167 <xsl:with-param name="message">
1168 <xsl:text>Converting ulink to phrase.</xsl:text>
1169 </xsl:with-param>
1170 </xsl:call-template>
1171
1172 <phrase xlink:href="{@url}">
1173 <xsl:call-template name="copy.attributes">
1174 <xsl:with-param name="suppress" select="'url'"/>
1175 </xsl:call-template>
1176 <xsl:apply-templates/>
1177 </phrase>
1178 </xsl:when>
1179 <xsl:otherwise>
1180 <xsl:call-template name="emit-message">
1181 <xsl:with-param name="message">
1182 <xsl:text>Converting ulink to uri.</xsl:text>
1183 </xsl:with-param>
1184 </xsl:call-template>
1185
1186 <uri xlink:href="{@url}">
1187 <xsl:call-template name="copy.attributes">
1188 <xsl:with-param name="suppress" select="'url'"/>
1189 </xsl:call-template>
1190 <xsl:value-of select="@url"/>
1191 </uri>
1192 </xsl:otherwise>
1193 </xsl:choose>
1194 </xsl:template>
1195
1196 <xsl:template match="sgmltag" priority="200" mode="copy">
1197 <tag>
1198 <xsl:call-template name="copy.attributes"/>
1199 <xsl:apply-templates/>
1200 </tag>
1201 </xsl:template>
1202 -->
1203
1204 <xsl:template match="*" mode="copy">
1205 <xsl:copy>
1206 <xsl:call-template name="copy.attributes"/>
1207 <xsl:apply-templates/>
1208 </xsl:copy>
1209 </xsl:template>
1210
1211 <!--
1212 <xsl:template match="comment()|processing-instruction()|text()" mode="copy">
1213 <xsl:copy/>
1214 </xsl:template>
1215 -->
1216
1217 <!-- ====================================================================== -->
1218
1219 <xsl:template match="*">
1220 <xsl:copy>
1221 <xsl:call-template name="copy.attributes"/>
1222 <xsl:apply-templates/>
1223 </xsl:copy>
1224 </xsl:template>
1225
1226 <xsl:template match="comment()|processing-instruction()|text()">
1227 <xsl:copy/>
1228 </xsl:template>
1229
1230 <!-- ====================================================================== -->
1231
1232 <xsl:template name="copy.attributes">
1233 <xsl:param name="src" select="."/>
1234 <xsl:param name="suppress" select="''"/>
1235
1236 <xsl:for-each select="$src/@*">
1237 <xsl:choose>
1238 <xsl:when test="local-name(.) = 'moreinfo'">
1239 <xsl:call-template name="emit-message">
1240 <xsl:with-param name="message">
1241 <xsl:text>Discarding moreinfo on </xsl:text>
1242 <xsl:value-of select="local-name($src)"/>
1243 </xsl:with-param>
1244 </xsl:call-template>
1245 </xsl:when>
1246 <xsl:when test="local-name(.) = 'lang'">
1247 <xsl:attribute name="xml:lang">
1248 <xsl:value-of select="."/>
1249 </xsl:attribute>
1250 </xsl:when>
1251 <xsl:when test="local-name(.) = 'id'">
1252 <xsl:attribute name="xml:id">
1253 <xsl:value-of select="."/>
1254 </xsl:attribute>
1255 </xsl:when>
1256 <xsl:when test="$suppress = local-name(.)"/>
1257 <xsl:when test="local-name(.) = 'float'">
1258 <xsl:choose>
1259 <xsl:when test=". = '1'">
1260 <xsl:call-template name="emit-message">
1261 <xsl:with-param name="message">
1262 <xsl:text>Discarding float on </xsl:text>
1263 <xsl:value-of select="local-name($src)"/>
1264 </xsl:with-param>
1265 </xsl:call-template>
1266 <xsl:if test="not($src/@floatstyle)">
1267 <xsl:call-template name="emit-message">
1268 <xsl:with-param name="message">
1269 <xsl:text>Adding floatstyle='normal' on </xsl:text>
1270 <xsl:value-of select="local-name($src)"/>
1271 </xsl:with-param>
1272 </xsl:call-template>
1273 <xsl:attribute name="floatstyle">
1274 <xsl:text>normal</xsl:text>
1275 </xsl:attribute>
1276 </xsl:if>
1277 </xsl:when>
1278 <xsl:when test=". = '0'">
1279 <xsl:call-template name="emit-message">
1280 <xsl:with-param name="message">
1281 <xsl:text>Discarding float on </xsl:text>
1282 <xsl:value-of select="local-name($src)"/>
1283 </xsl:with-param>
1284 </xsl:call-template>
1285 </xsl:when>
1286 <xsl:otherwise>
1287 <xsl:call-template name="emit-message">
1288 <xsl:with-param name="message">
1289 <xsl:text>Discarding float on </xsl:text>
1290 <xsl:value-of select="local-name($src)"/>
1291 </xsl:with-param>
1292 </xsl:call-template>
1293 <xsl:if test="not($src/@floatstyle)">
1294 <xsl:call-template name="emit-message">
1295 <xsl:with-param name="message">
1296 <xsl:text>Adding floatstyle='</xsl:text>
1297 <xsl:value-of select="."/>
1298 <xsl:text>' on </xsl:text>
1299 <xsl:value-of select="local-name($src)"/>
1300 </xsl:with-param>
1301 </xsl:call-template>
1302 <xsl:attribute name="floatstyle">
1303 <xsl:value-of select="."/>
1304 </xsl:attribute>
1305 </xsl:if>
1306 </xsl:otherwise>
1307 </xsl:choose>
1308 </xsl:when>
1309 <xsl:when test="local-name(.) = 'entityref'">
1310 <xsl:attribute name="fileref">
1311 <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
1312 </xsl:attribute>
1313 </xsl:when>
1314
1315 <xsl:when test="local-name($src) = 'simplemsgentry'
1316 and local-name(.) = 'audience'">
1317 <xsl:attribute name="msgaud">
1318 <xsl:value-of select="."/>
1319 </xsl:attribute>
1320 </xsl:when>
1321 <xsl:when test="local-name($src) = 'simplemsgentry'
1322 and local-name(.) = 'origin'">
1323 <xsl:attribute name="msgorig">
1324 <xsl:value-of select="."/>
1325 </xsl:attribute>
1326 </xsl:when>
1327 <xsl:when test="local-name($src) = 'simplemsgentry'
1328 and local-name(.) = 'level'">
1329 <xsl:attribute name="msglevel">
1330 <xsl:value-of select="."/>
1331 </xsl:attribute>
1332 </xsl:when>
1333
1334 <!-- * for upgrading XSL litprog params documentation -->
1335 <xsl:when test="local-name($src) = 'refmiscinfo'
1336 and local-name(.) = 'role'
1337 and . = 'type'
1338 ">
1339 <xsl:call-template name="emit-message">
1340 <xsl:with-param name="message">
1341 <xsl:text>Converting refmiscinfo@role=type to </xsl:text>
1342 <xsl:text>@class=other,otherclass=type</xsl:text>
1343 </xsl:with-param>
1344 </xsl:call-template>
1345 <xsl:attribute name="class">other</xsl:attribute>
1346 <xsl:attribute name="otherclass">type</xsl:attribute>
1347 </xsl:when>
1348
1349 <xsl:otherwise>
1350 <xsl:copy/>
1351 </xsl:otherwise>
1352 </xsl:choose>
1353 </xsl:for-each>
1354 </xsl:template>
1355
1356 <!-- ====================================================================== -->
1357
1358 <xsl:template match="*" mode="addNS">
1359 <xsl:choose>
1360 <xsl:when test="namespace-uri(.) = ''">
1361 <xsl:element name="{local-name(.)}"
1362 namespace="http://docbook.org/ns/docbook">
1363 <xsl:if test="not(parent::*)">
1364 <xsl:attribute name="version">5.0</xsl:attribute>
1365 </xsl:if>
1366 <xsl:copy-of select="@*"/>
1367 <xsl:apply-templates mode="addNS"/>
1368 </xsl:element>
1369 </xsl:when>
1370 <xsl:otherwise>
1371 <xsl:copy>
1372 <xsl:if test="not(parent::*)">
1373 <xsl:attribute name="version">5.0</xsl:attribute>
1374 </xsl:if>
1375 <xsl:copy-of select="@*"/>
1376 <xsl:apply-templates mode="addNS"/>
1377 </xsl:copy>
1378 </xsl:otherwise>
1379 </xsl:choose>
1380 </xsl:template>
1381
1382 <xsl:template match="comment()|processing-instruction()|text()" mode="addNS">
1383 <xsl:copy/>
1384 </xsl:template>
1385
1386 <!-- ====================================================================== -->
1387
1388 <xsl:template name="emit-message">
1389 <xsl:param name="message"/>
1390 <xsl:message>
1391 <xsl:value-of select="$message"/>
1392 <xsl:text> (</xsl:text>
1393 <xsl:value-of select="$rootid"/>
1394 <xsl:text>)</xsl:text>
1395 </xsl:message>
1396 </xsl:template>
1397
1398 </xsl:stylesheet>