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"
10 # ======================================================================
11 # This file is part of DocBook V5.0CR5
13 # Copyright 2005 Norman Walsh, Sun Microsystems, Inc., and the
14 # Organization for the Advancement of Structured Information
17 # Release: $Id: db4-upgrade.xsl 7660 2008-02-06 13:48:36Z nwalsh $
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
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/.
31 # ======================================================================
34 <xsl:variable name="version" select="'1.0'"/>
36 <xsl:output method="xml" encoding="utf-8" indent="no" omit-xml-declaration="yes"/>
38 <xsl:preserve-space elements="*"/>
39 <xsl:param name="rootid">
41 <xsl:when test="/*/@id">
42 <xsl:value-of select="/*/@id"/>
45 <xsl:text>UNKNOWN</xsl:text>
50 <xsl:param name="defaultDate" select="''"/>
52 <xsl:template match="/">
53 <xsl:variable name="converted">
54 <xsl:apply-templates/>
57 <xsl:text> Converted by db4-upgrade version </xsl:text>
58 <xsl:value-of select="$version"/>
59 <xsl:text> </xsl:text>
61 <xsl:text> </xsl:text>
62 <xsl:apply-templates select="exsl:node-set($converted)/*" mode="addNS"/>
65 <xsl:template match="bookinfo|chapterinfo|articleinfo|artheader|appendixinfo
67 |bibliographyinfo|glossaryinfo|indexinfo|setinfo
69 |sect1info|sect2info|sect3info|sect4info|sect5info
71 |refsect1info|refsect2info|refsect3info|refsectioninfo
72 |referenceinfo|partinfo"
75 <xsl:call-template name="copy.attributes"/>
77 <!-- titles can be inside or outside or both. fix that -->
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>
89 <xsl:apply-templates select="title" mode="copy"/>
91 <xsl:when test="title">
92 <xsl:apply-templates select="title" mode="copy"/>
94 <xsl:when test="following-sibling::title">
95 <xsl:apply-templates select="following-sibling::title" mode="copy"/>
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>
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>
119 <xsl:apply-templates select="titleabbrev" mode="copy"/>
121 <xsl:when test="titleabbrev">
122 <xsl:apply-templates select="titleabbrev" mode="copy"/>
124 <xsl:when test="following-sibling::titleabbrev">
125 <xsl:apply-templates select="following-sibling::titleabbrev" mode="copy"/>
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>
140 <xsl:apply-templates select="subtitle" mode="copy"/>
142 <xsl:when test="subtitle">
143 <xsl:apply-templates select="subtitle" mode="copy"/>
145 <xsl:when test="following-sibling::subtitle">
146 <xsl:apply-templates select="following-sibling::subtitle" mode="copy"/>
150 <xsl:apply-templates/>
154 <xsl:template match="objectinfo|prefaceinfo|refsynopsisdivinfo
155 |screeninfo|sidebarinfo"
158 <xsl:call-template name="copy.attributes"/>
160 <!-- titles can be inside or outside or both. fix that -->
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>
172 <xsl:apply-templates select="title" mode="copy"/>
174 <xsl:when test="title">
175 <xsl:apply-templates select="title" mode="copy"/>
177 <xsl:when test="following-sibling::title">
178 <xsl:apply-templates select="following-sibling::title" mode="copy"/>
181 <!-- it's ok if there's no title on these -->
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>
196 <xsl:apply-templates select="titleabbrev" mode="copy"/>
198 <xsl:when test="titleabbrev">
199 <xsl:apply-templates select="titleabbrev" mode="copy"/>
201 <xsl:when test="following-sibling::titleabbrev">
202 <xsl:apply-templates select="following-sibling::titleabbrev" mode="copy"/>
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>
217 <xsl:apply-templates select="subtitle" mode="copy"/>
219 <xsl:when test="subtitle">
220 <xsl:apply-templates select="subtitle" mode="copy"/>
222 <xsl:when test="following-sibling::subtitle">
223 <xsl:apply-templates select="following-sibling::subtitle" mode="copy"/>
227 <xsl:apply-templates/>
231 <xsl:template match="refentryinfo"
234 <xsl:call-template name="copy.attributes"/>
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>
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>
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>
261 <xsl:apply-templates/>
265 <xsl:template match="refmiscinfo"
268 <xsl:call-template name="copy.attributes">
269 <xsl:with-param name="suppress" select="'class'"/>
271 <xsl:if test="@class">
273 <xsl:when test="@class = 'source'
274 or @class = 'version'
276 or @class = 'sectdesc'
277 or @class = 'software'">
278 <xsl:attribute name="class">
279 <xsl:value-of select="@class"/>
283 <xsl:attribute name="class">
284 <xsl:value-of select="'other'"/>
286 <xsl:attribute name="otherclass">
287 <xsl:value-of select="@class"/>
292 <xsl:apply-templates/>
296 <xsl:template match="corpauthor" priority="200">
298 <xsl:call-template name="copy.attributes"/>
300 <xsl:apply-templates/>
305 <xsl:template match="corpname" priority="200">
307 <xsl:call-template name="copy.attributes"/>
308 <xsl:apply-templates/>
312 <xsl:template match="author[not(personname)]|editor[not(personname)]|othercredit[not(personname)]" priority="200">
314 <xsl:call-template name="copy.attributes"/>
316 <xsl:apply-templates select="honorific|firstname|surname|othername|lineage"/>
318 <xsl:apply-templates select="*[not(self::honorific|self::firstname|self::surname
319 |self::othername|self::lineage)]"/>
323 <xsl:template match="address|programlisting|screen|funcsynopsisinfo
324 |classsynopsisinfo|literallayout" priority="200">
326 <xsl:call-template name="copy.attributes">
327 <xsl:with-param name="suppress" select="'format'"/>
329 <xsl:apply-templates/>
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>
340 <xsl:call-template name="copy.attributes">
341 <xsl:with-param name="suppress" select="'class'"/>
343 <xsl:apply-templates/>
347 <xsl:template match="dedication|preface|chapter|appendix|part|partintro
348 |article|bibliography|glossary|glossdiv|index
349 |reference[not(referenceinfo)]
350 |book" priority="200">
352 <xsl:when test="not(dedicationinfo|prefaceinfo|chapterinfo
353 |appendixinfo|partinfo
354 |articleinfo|artheader|bibliographyinfo
355 |glossaryinfo|indexinfo
358 <xsl:call-template name="copy.attributes"/>
359 <xsl:if test="title|subtitle|titleabbrev">
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"/>
367 <xsl:apply-templates/>
372 <xsl:call-template name="copy.attributes"/>
373 <xsl:apply-templates/>
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
387 <xsl:when test="blockinfo">
389 <xsl:call-template name="copy.attributes"/>
390 <xsl:apply-templates/>
395 <xsl:call-template name="copy.attributes"/>
397 <xsl:if test="title|titleabbrev|subtitle">
399 <xsl:apply-templates select="title" mode="copy"/>
400 <xsl:apply-templates select="titleabbrev" mode="copy"/>
401 <xsl:apply-templates select="subtitle" mode="copy"/>
405 <xsl:apply-templates/>
411 <xsl:template match="equation" priority="200">
413 <xsl:when test="not(title)">
414 <xsl:call-template name="emit-message">
417 >Convert equation without title to informal equation.</xsl:with-param>
420 <xsl:call-template name="copy.attributes"/>
421 <xsl:apply-templates/>
424 <xsl:when test="blockinfo">
426 <xsl:call-template name="copy.attributes"/>
427 <xsl:apply-templates/>
432 <xsl:call-template name="copy.attributes"/>
434 <xsl:apply-templates select="title" mode="copy"/>
435 <xsl:apply-templates select="titleabbrev" mode="copy"/>
436 <xsl:apply-templates select="subtitle" mode="copy"/>
438 <xsl:apply-templates/>
444 <xsl:template match="sect1|sect2|sect3|sect4|sect5|section"
447 <xsl:call-template name="copy.attributes"/>
449 <xsl:if test="not(sect1info|sect2info|sect3info|sect4info|sect5info|sectioninfo)">
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"/>
457 <xsl:apply-templates/>
461 <xsl:template match="simplesect"
464 <xsl:call-template name="copy.attributes"/>
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"/>
471 <xsl:apply-templates/>
475 <xsl:template match="refsect1|refsect2|refsect3|refsection" priority="200">
477 <xsl:call-template name="copy.attributes"/>
479 <xsl:if test="not(refsect1info|refsect2info|refsect3info|refsectioninfo)">
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"/>
487 <xsl:apply-templates/>
491 <xsl:template match="imagedata|videodata|audiodata|textdata" priority="200">
493 <xsl:call-template name="copy.attributes">
494 <xsl:with-param name="suppress" select="'srccredit'"/>
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>
504 <othercredit class="other" otherclass="srccredit">
505 <orgname>???</orgname>
507 <xsl:value-of select="@srccredit"/>
515 <xsl:template match="sgmltag" priority="200">
517 <xsl:call-template name="copy.attributes"/>
518 <xsl:if test="@class = 'sgmlcomment'">
519 <xsl:attribute name="class">comment</xsl:attribute>
521 <xsl:apply-templates/>
525 <xsl:template match="inlinegraphic[@format='linespecific']" priority="210">
528 <xsl:call-template name="copy.attributes"/>
533 <xsl:template match="inlinegraphic" priority="200">
537 <xsl:call-template name="copy.attributes"/>
543 <xsl:template match="graphic[@format='linespecific']" priority="210">
547 <xsl:call-template name="copy.attributes"/>
553 <xsl:template match="graphic" priority="200">
557 <xsl:call-template name="copy.attributes"/>
563 <xsl:template match="pubsnumber" priority="200">
564 <biblioid class="pubsnumber">
565 <xsl:call-template name="copy.attributes"/>
566 <xsl:apply-templates/>
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>
576 <biblioid class="other" otherclass="invpartnumber">
577 <xsl:call-template name="copy.attributes"/>
578 <xsl:apply-templates/>
582 <xsl:template match="contractsponsor" priority="200">
583 <xsl:variable name="contractnum"
584 select="preceding-sibling::contractnum|following-sibling::contractnum"/>
586 <xsl:call-template name="emit-message">
587 <xsl:with-param name="message">
588 <xsl:text>Converting contractsponsor to othercredit="contractsponsor".</xsl:text>
592 <othercredit class="other" otherclass="contractsponsor">
594 <xsl:call-template name="copy.attributes"/>
595 <xsl:apply-templates/>
597 <xsl:for-each select="$contractnum">
598 <contrib role="contractnum">
599 <xsl:apply-templates select="node()"/>
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>
615 <othercredit class="other" otherclass="contractnum">
616 <orgname>???</orgname>
617 <xsl:for-each select="self::contractnum
618 |preceding-sibling::contractnum
619 |following-sibling::contractnum">
621 <xsl:apply-templates select="node()"/>
628 <xsl:template match="isbn|issn" priority="200">
629 <biblioid class="{local-name(.)}">
630 <xsl:call-template name="copy.attributes"/>
631 <xsl:apply-templates/>
635 <xsl:template match="biblioid[count(*) = 1
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()"/>
644 <xsl:template match="authorblurb" priority="200">
646 <xsl:call-template name="copy.attributes"/>
647 <xsl:apply-templates/>
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>
658 <orgname role="collabname">
659 <xsl:call-template name="copy.attributes"/>
660 <xsl:apply-templates/>
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>
674 <xsl:template match="mediaobjectco" priority="200">
676 <xsl:copy-of select="@*"/>
677 <xsl:apply-templates/>
681 <xsl:template match="remark" priority="200">
682 <!-- get rid of any embedded markup -->
684 <xsl:copy-of select="@*"/>
685 <xsl:value-of select="."/>
689 <xsl:template match="biblioentry/title
692 |bibliomixed/title" priority="400">
694 <xsl:copy-of select="@*"/>
695 <xsl:apply-templates/>
699 <xsl:template match="biblioentry/titleabbrev|biblioentry/subtitle
700 |bibliomset/titleabbrev|bibliomset/subtitle
701 |biblioset/titleabbrev|biblioset/subtitle
702 |bibliomixed/titleabbrev|bibliomixed/subtitle"
705 <xsl:copy-of select="@*"/>
706 <xsl:apply-templates/>
710 <xsl:template match="biblioentry/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>
719 <othercredit class="other" otherclass="contrib">
720 <orgname>???</orgname>
722 <xsl:call-template name="copy.attributes"/>
723 <xsl:apply-templates/>
728 <xsl:template match="link" priority="200">
730 <xsl:call-template name="copy.attributes"/>
731 <xsl:apply-templates/>
735 <xsl:template match="ulink" priority="200">
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>
744 <link xlink:href="{@url}">
745 <xsl:call-template name="copy.attributes">
746 <xsl:with-param name="suppress" select="'url'"/>
748 <xsl:apply-templates/>
752 <xsl:call-template name="emit-message">
753 <xsl:with-param name="message">
754 <xsl:text>Converting ulink to uri.</xsl:text>
758 <uri xlink:href="{@url}">
759 <xsl:call-template name="copy.attributes">
760 <xsl:with-param name="suppress" select="'url'"/>
762 <xsl:value-of select="@url"/>
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>
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>
785 <olink targetdoc="{unparsed-entity-uri(@targetdocent)}">
786 <xsl:for-each select="@*">
787 <xsl:if test="name(.) != 'targetdocent'
788 and name(.) != 'linkmode'">
792 <xsl:apply-templates/>
797 <xsl:for-each select="@*">
798 <xsl:if test="name(.) != 'linkmode'">
802 <xsl:apply-templates/>
808 <xsl:template match="biblioentry/firstname
810 |biblioentry/othername
812 |biblioentry/honorific
813 |bibliomset/firstname
815 |bibliomset/othername
817 |bibliomset/honorific" priority="200">
819 <xsl:when test="preceding-sibling::firstname
820 |preceding-sibling::surname
821 |preceding-sibling::othername
822 |preceding-sibling::lineage
823 |preceding-sibling::honorific">
828 <xsl:apply-templates select="../firstname
832 |../honorific" mode="copy"/>
838 <xsl:template match="areaset" priority="200">
840 <xsl:call-template name="copy.attributes">
841 <xsl:with-param name="suppress" select="'coords'"/>
843 <xsl:apply-templates/>
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(.), ' '),
852 <xsl:variable name="rp3"
853 select="substring-after(substring-after(normalize-space(.), ' '), ' ')"/>
855 <xsl:variable name="p1">
857 <xsl:when test="contains($rp1, ',')">
858 <xsl:value-of select="substring-before($rp1, ',')"/>
861 <xsl:value-of select="$rp1"/>
866 <xsl:variable name="p2">
868 <xsl:when test="contains($rp2, ',')">
869 <xsl:value-of select="substring-before($rp2, ',')"/>
872 <xsl:value-of select="$rp2"/>
877 <xsl:variable name="p3">
879 <xsl:when test="contains($rp3, ',')">
880 <xsl:value-of select="substring-before($rp3, ',')"/>
883 <xsl:value-of select="$rp3"/>
888 <xsl:variable name="date">
890 <xsl:when test="string($p1+1) != 'NaN' and string($p3+1) != 'NaN'">
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
953 <xsl:apply-templates/>
957 <xsl:when test="string($p2+1) != 'NaN' and string($p3+1) != 'NaN'">
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
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"/>
1020 <xsl:apply-templates/>
1025 <xsl:apply-templates/>
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(.)"/>
1041 </xsl:call-template>
1044 <xsl:copy-of select="@*"/>
1045 <xsl:value-of select="$date"/>
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>
1060 </xsl:call-template>
1063 <xsl:copy-of select="@*"/>
1064 <xsl:copy-of select="$defaultDate"/>
1066 <xsl:value-of select="."/>
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(.)"/>
1080 </xsl:call-template>
1083 <xsl:copy-of select="@*"/>
1084 <xsl:apply-templates/>
1090 <xsl:template match="title|subtitle|titleabbrev" priority="300">
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>
1100 </xsl:call-template>
1104 <xsl:template match="indexterm">
1105 <!-- don't copy the defaulted significance='normal' attribute -->
1107 <xsl:call-template name="copy.attributes">
1108 <xsl:with-param name="suppress">
1109 <xsl:if test="@significance = 'normal'">significance</xsl:if>
1111 </xsl:call-template>
1112 <xsl:apply-templates/>
1116 <xsl:template match="ackno" priority="200">
1118 <xsl:copy-of select="@*"/>
1120 <xsl:apply-templates/>
1125 <xsl:template match="lot|lotentry|tocback|tocchap|tocfront|toclevel1|
1126 toclevel2|toclevel3|toclevel4|toclevel5|tocpart" priority="200">
1128 <xsl:copy-of select="@*"/>
1129 <xsl:apply-templates/>
1133 <xsl:template match="action" priority="200">
1134 <phrase remap="action">
1135 <xsl:call-template name="copy.attributes"/>
1136 <xsl:apply-templates/>
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>
1146 </xsl:call-template>
1149 <xsl:template match="structname|structfield" priority="200">
1150 <varname remap="{local-name(.)}">
1151 <xsl:call-template name="copy.attributes"/>
1152 <xsl:apply-templates/>
1156 <!-- ====================================================================== -->
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 -->
1163 <xsl:template match="ulink" priority="200" mode="copy">
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>
1170 </xsl:call-template>
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/>
1180 <xsl:call-template name="emit-message">
1181 <xsl:with-param name="message">
1182 <xsl:text>Converting ulink to uri.</xsl:text>
1184 </xsl:call-template>
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"/>
1196 <xsl:template match="sgmltag" priority="200" mode="copy">
1198 <xsl:call-template name="copy.attributes"/>
1199 <xsl:apply-templates/>
1204 <xsl:template match="*" mode="copy">
1206 <xsl:call-template name="copy.attributes"/>
1207 <xsl:apply-templates/>
1212 <xsl:template match="comment()|processing-instruction()|text()" mode="copy">
1217 <!-- ====================================================================== -->
1219 <xsl:template match="*">
1221 <xsl:call-template name="copy.attributes"/>
1222 <xsl:apply-templates/>
1226 <xsl:template match="comment()|processing-instruction()|text()">
1230 <!-- ====================================================================== -->
1232 <xsl:template name="copy.attributes">
1233 <xsl:param name="src" select="."/>
1234 <xsl:param name="suppress" select="''"/>
1236 <xsl:for-each select="$src/@*">
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)"/>
1244 </xsl:call-template>
1246 <xsl:when test="local-name(.) = 'lang'">
1247 <xsl:attribute name="xml:lang">
1248 <xsl:value-of select="."/>
1251 <xsl:when test="local-name(.) = 'id'">
1252 <xsl:attribute name="xml:id">
1253 <xsl:value-of select="."/>
1256 <xsl:when test="$suppress = local-name(.)"/>
1257 <xsl:when test="local-name(.) = 'float'">
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)"/>
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)"/>
1272 </xsl:call-template>
1273 <xsl:attribute name="floatstyle">
1274 <xsl:text>normal</xsl:text>
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)"/>
1284 </xsl:call-template>
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)"/>
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)"/>
1301 </xsl:call-template>
1302 <xsl:attribute name="floatstyle">
1303 <xsl:value-of select="."/>
1309 <xsl:when test="local-name(.) = 'entityref'">
1310 <xsl:attribute name="fileref">
1311 <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
1315 <xsl:when test="local-name($src) = 'simplemsgentry'
1316 and local-name(.) = 'audience'">
1317 <xsl:attribute name="msgaud">
1318 <xsl:value-of select="."/>
1321 <xsl:when test="local-name($src) = 'simplemsgentry'
1322 and local-name(.) = 'origin'">
1323 <xsl:attribute name="msgorig">
1324 <xsl:value-of select="."/>
1327 <xsl:when test="local-name($src) = 'simplemsgentry'
1328 and local-name(.) = 'level'">
1329 <xsl:attribute name="msglevel">
1330 <xsl:value-of select="."/>
1334 <!-- * for upgrading XSL litprog params documentation -->
1335 <xsl:when test="local-name($src) = 'refmiscinfo'
1336 and local-name(.) = 'role'
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>
1344 </xsl:call-template>
1345 <xsl:attribute name="class">other</xsl:attribute>
1346 <xsl:attribute name="otherclass">type</xsl:attribute>
1356 <!-- ====================================================================== -->
1358 <xsl:template match="*" mode="addNS">
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>
1366 <xsl:copy-of select="@*"/>
1367 <xsl:apply-templates mode="addNS"/>
1372 <xsl:if test="not(parent::*)">
1373 <xsl:attribute name="version">5.0</xsl:attribute>
1375 <xsl:copy-of select="@*"/>
1376 <xsl:apply-templates mode="addNS"/>
1382 <xsl:template match="comment()|processing-instruction()|text()" mode="addNS">
1386 <!-- ====================================================================== -->
1388 <xsl:template name="emit-message">
1389 <xsl:param name="message"/>
1391 <xsl:value-of select="$message"/>
1392 <xsl:text> (</xsl:text>
1393 <xsl:value-of select="$rootid"/>
1394 <xsl:text>)</xsl:text>