Debian Codegraph @

docbook-xsl-ns/slides/tools/dbs3-upgrade.xsl

raw symbols SCIP
1 <?xml version="1.0" encoding="ASCII"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns="http://docbook.org/ns/docbook"
4 xmlns:dbs="http://docbook.org/ns/docbook-slides"
5 xmlns:xlink="http://www.w3.org/1999/xlink"
6 version="1.0">
7
8 <xsl:output method="xml" encoding="utf-8" indent="no"/>
9
10 <xsl:preserve-space elements="*"/>
11
12 <xsl:template match="/slides">
13 <dbs:slides>
14 <xsl:call-template name="process.content"/>
15 </dbs:slides>
16 </xsl:template>
17
18 <xsl:template name="process.content">
19 <xsl:apply-templates select="slidesinfo|foilgroupinfo|foilinfo|title|titleabbrev|subtitle"/>
20
21 <xsl:apply-templates select="speakernotes"/>
22
23 <xsl:apply-templates select="*[not(self::speakernotes)][not(self::title)][not(self::titleabbrev)][not(self::subtitle)][not(self::slidesinfo)][not(self::foilinfo)][not(self::foilgroupinfo)]"/>
24 </xsl:template>
25
26 <xsl:template match="foil">
27 <dbs:foil>
28 <xsl:call-template name="copy.attributes"/>
29
30 <xsl:call-template name="process.content"/>
31 </dbs:foil>
32 </xsl:template>
33
34 <xsl:template match="foilgroup">
35 <dbs:foilgroup>
36 <xsl:call-template name="copy.attributes"/>
37
38 <xsl:call-template name="process.content"/>
39 </dbs:foilgroup>
40 </xsl:template>
41
42 <xsl:template match="speakernotes">
43 <dbs:speakernotes>
44 <xsl:call-template name="copy.attributes"/>
45
46 <xsl:apply-templates select="*"/>
47 </dbs:speakernotes>
48 </xsl:template>
49
50 <xsl:template match="slidesinfo|foilgroupinfo|foilinfo">
51 <info>
52 <xsl:call-template name="copy.attributes"/>
53
54 <xsl:apply-templates select="*"/>
55 </info>
56 </xsl:template>
57
58 <!-- ******************************************************************
59 DB4 -> DB5 related, adapted from db4-upgrade.xsl
60 ****************************************************************** -->
61
62 <xsl:template name="copy.attributes">
63 <xsl:param name="suppress" select="''"/>
64
65 <xsl:for-each select="@*">
66 <xsl:choose>
67 <xsl:when test="local-name(.) = 'lang'">
68 <xsl:attribute name="xml:lang">
69 <xsl:value-of select="."/>
70 </xsl:attribute>
71 </xsl:when>
72 <xsl:when test="local-name(.) = 'id'">
73 <xsl:attribute name="xml:id">
74 <xsl:value-of select="."/>
75 </xsl:attribute>
76 </xsl:when>
77 <xsl:when test="local-name(.) = 'moreinfo'"/>
78 <xsl:when test="$suppress = local-name(.)"/>
79 <xsl:otherwise>
80 <xsl:copy/>
81 </xsl:otherwise>
82 </xsl:choose>
83 </xsl:for-each>
84 </xsl:template>
85
86 <xsl:template match="*">
87 <xsl:element name="{local-name()}" namespace="http://docbook.org/ns/docbook">
88 <xsl:call-template name="copy.attributes"/>
89
90 <xsl:apply-templates />
91 </xsl:element>
92 </xsl:template>
93
94 <xsl:template match="author[not(personname)]|editor[not(personname)]|othercredit[not(personname)]">
95 <xsl:element name="{local-name()}" namespace="http://docbook.org/ns/docbook">
96 <xsl:call-template name="copy.attributes"/>
97
98 <personname>
99 <xsl:apply-templates select="honorific|firstname|surname|othername|lineage"/>
100 </personname>
101
102 <xsl:apply-templates select="*[not(self::honorific|self::firstname|self::surname
103 |self::othername|self::lineage)]"/>
104 </xsl:element>
105 </xsl:template>
106
107 <xsl:template match="address|programlisting|screen|funcsynopsisinfo
108 |classsynopsisinfo|literallayout">
109 <xsl:element name="{local-name()}" namespace="http://docbook.org/ns/docbook">
110 <xsl:call-template name="copy.attributes">
111 <xsl:with-param name="suppress" select="'format'"/>
112 </xsl:call-template>
113 <xsl:apply-templates/>
114 </xsl:element>
115 </xsl:template>
116
117 <xsl:template match="inlinegraphic[@format='linespecific']">
118 <textobject>
119 <textdata>
120 <xsl:call-template name="copy.attributes"/>
121 </textdata>
122 </textobject>
123 </xsl:template>
124
125 <xsl:template match="inlinegraphic">
126 <inlinemediaobject>
127 <imageobject>
128 <imagedata>
129 <xsl:call-template name="copy.attributes"/>
130 </imagedata>
131 </imageobject>
132 </inlinemediaobject>
133 </xsl:template>
134
135 <xsl:template match="graphic[@format='linespecific']">
136 <mediaobject>
137 <textobject>
138 <textdata>
139 <xsl:call-template name="copy.attributes"/>
140 </textdata>
141 </textobject>
142 </mediaobject>
143 </xsl:template>
144
145 <xsl:template match="graphic">
146 <mediaobject>
147 <imageobject>
148 <imagedata>
149 <xsl:call-template name="copy.attributes"/>
150 </imagedata>
151 </imageobject>
152 </mediaobject>
153 </xsl:template>
154
155 <xsl:template match="ulink" priority="200">
156 <xsl:choose>
157 <xsl:when test="node()">
158 <link xlink:href="{@url}">
159 <xsl:call-template name="copy.attributes">
160 <xsl:with-param name="suppress" select="'url'"/>
161 </xsl:call-template>
162 <xsl:apply-templates/>
163 </link>
164 </xsl:when>
165 <xsl:otherwise>
166 <uri xlink:href="{@url}">
167 <xsl:call-template name="copy.attributes">
168 <xsl:with-param name="suppress" select="'url'"/>
169 </xsl:call-template>
170 <xsl:value-of select="@url"/>
171 </uri>
172 </xsl:otherwise>
173 </xsl:choose>
174 </xsl:template>
175
176 <xsl:template match="*[namespace-uri()]">
177 <xsl:copy-of select="."/>
178 </xsl:template>
179
180 </xsl:stylesheet>