1 | <?xml version="1.0" encoding="utf-8" standalone="no"?>
|
---|
2 | <!--
|
---|
3 | | LICENSE: This file is part of the DITA Open Toolkit project hosted on
|
---|
4 | | Sourceforge.net. See the accompanying license.txt file for
|
---|
5 | | applicable licenses.
|
---|
6 | *-->
|
---|
7 | <!--
|
---|
8 | | (C) Copyright IBM Corporation 2006. All Rights Reserved.
|
---|
9 | *-->
|
---|
10 | <!-- gsl meaning the XSLT that generate an XSL transform -->
|
---|
11 | <gsl:stylesheet version="1.0"
|
---|
12 | xmlns:gsl="http://www.w3.org/1999/XSL/Transform"
|
---|
13 | xmlns:xsl="output.xsl"
|
---|
14 | xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
---|
15 | xmlns:saxon="http://icl.com/saxon"
|
---|
16 | xmlns:xalan="http://xml.apache.org/xalan/redirect"
|
---|
17 | xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
|
---|
18 | extension-element-prefixes="saxon xalan ditaarch"
|
---|
19 | exclude-result-prefixes="xs gsl">
|
---|
20 |
|
---|
21 | <!-- Principle:
|
---|
22 | The output driver knows how to generate valid output and offers
|
---|
23 | a target for everything in the schema that can be instanced
|
---|
24 | in a DITA XML document that conforms to the document type.
|
---|
25 | In addition, the output driver understands the content for
|
---|
26 | each context. Where the content model consists of a simple
|
---|
27 | sequence, the output driver pulls what's required at every
|
---|
28 | position. For mixed content, a choice, or complex content
|
---|
29 | models, the output driver pulls the type of content model
|
---|
30 | and, if that's not handled, fires all children of the input.
|
---|
31 | The input driver knows the input and thus knows how map any input
|
---|
32 | context to what's currently expected in the output context.
|
---|
33 | -->
|
---|
34 |
|
---|
35 | <gsl:param name="outdir">.</gsl:param>
|
---|
36 |
|
---|
37 | <gsl:output
|
---|
38 | method="xml"
|
---|
39 | indent="yes"
|
---|
40 | omit-xml-declaration="no"
|
---|
41 | standalone="no"/>
|
---|
42 |
|
---|
43 | <gsl:namespace-alias stylesheet-prefix="xsl" result-prefix="gsl"/>
|
---|
44 |
|
---|
45 | <gsl:key name="typedef"
|
---|
46 | match="xs:complexType[contains(@name,'.class')]"
|
---|
47 | use="substring-before(@name,'.class')"/>
|
---|
48 |
|
---|
49 | <gsl:key name="groupdef"
|
---|
50 | match="xs:group[contains(@name,'.cnt')]"
|
---|
51 | use="@name"/>
|
---|
52 |
|
---|
53 | <gsl:key name="attgroupdef"
|
---|
54 | match="xs:attributeGroup[@name]"
|
---|
55 | use="@name"/>
|
---|
56 |
|
---|
57 | <gsl:key name="attdef"
|
---|
58 | match="xs:attribute[@name or @ref]"
|
---|
59 | use="@name|@ref"/>
|
---|
60 |
|
---|
61 | <!--
|
---|
62 |
|
---|
63 | input module files moduleName.elementName.out to emit the element
|
---|
64 | moduleName.outputElementName.out fires
|
---|
65 | moduleName.outputElementName.atts.in on self
|
---|
66 | moduleName.outputElementName.content.in on self
|
---|
67 | moduleName.outputElementName.atts.in fires
|
---|
68 | for each attributeName
|
---|
69 | moduleName.outputElementName.attributeName.att.in on self
|
---|
70 | moduleName.outputElementName.attributeName.att.in fires
|
---|
71 | if attributeName is a group
|
---|
72 | moduleName.outputElementName.attributeName.att.in on self
|
---|
73 | if attributeName is a single attribute
|
---|
74 | attributeName.att.in on self
|
---|
75 | = may override to provide input processing for the attribute
|
---|
76 | in a specific output context
|
---|
77 | attributeName.att.in is noop
|
---|
78 | = may override to provide default input processing for the attribute
|
---|
79 | moduleName.outputElementName.content.in fires
|
---|
80 | if the content model has one content group and mixed content
|
---|
81 | (as with topic/p)
|
---|
82 | groupName.text.in on self
|
---|
83 | if the content model has mixed content
|
---|
84 | moduleName.outputElementName.child on *|text()
|
---|
85 | if the content model has one content group
|
---|
86 | groupName.in on self
|
---|
87 | if the content model has nested choice and sequence
|
---|
88 | (as with task/taskbody)
|
---|
89 | moduleName.outputElementName.child on *
|
---|
90 | if the content model has a simple sequence
|
---|
91 | (as with topic/topic)
|
---|
92 | for each child element
|
---|
93 | moduleName.outputElementName.moduleName.inputElementName.in on self
|
---|
94 | if the content model has a choice
|
---|
95 | (as with topic/body)
|
---|
96 | moduleName.outputElementName.child on *
|
---|
97 | moduleName.outputElementName.moduleName.inputElementName.in fires
|
---|
98 | moduleName.inputElementName.in on self
|
---|
99 | = may override to provide input processing for the element
|
---|
100 | in a specific output context
|
---|
101 | moduleName.inputElementName.in noop
|
---|
102 | = may override to provide default input processing for the element
|
---|
103 | when expected in a context
|
---|
104 | groupName.in fires
|
---|
105 | if the content model has a sequence
|
---|
106 | moduleName.inputElementName.in on self
|
---|
107 | if the content model has a content group
|
---|
108 | groupName.child on *
|
---|
109 | = may override to provide default input processing
|
---|
110 | for the content group
|
---|
111 | groupName.text.in fires
|
---|
112 | groupName.child on *|text()
|
---|
113 | = may override to provide default input processing
|
---|
114 | for the content group in mixed content models
|
---|
115 | moduleName.outputElementName.child fires
|
---|
116 | child on self
|
---|
117 | groupName.child fires
|
---|
118 | child on self
|
---|
119 | child noop
|
---|
120 | = may override to provide default input processing for children
|
---|
121 |
|
---|
122 | to suppress an input element, write a noop for the child mode
|
---|
123 | -->
|
---|
124 |
|
---|
125 | <!-- TO DO
|
---|
126 | driver parameter for whether a migration or processing conversion
|
---|
127 | to control whether to emit <required-cleanup> or a comment
|
---|
128 | for unsupported constructs
|
---|
129 | parameter to split out generated topics as separate files
|
---|
130 |
|
---|
131 | pass isRequired to pull.in.fire
|
---|
132 | attributes rules should take instead of generate required parameter
|
---|
133 | default rule to put everything unknown in either comment or
|
---|
134 | provide some manually-maintained utilities
|
---|
135 | rule to generate <dita> element
|
---|
136 | alphabetize attributes rules
|
---|
137 | who chooses the output document type?
|
---|
138 | child topics should be determined from info-types
|
---|
139 | -->
|
---|
140 |
|
---|
141 | <gsl:template match="/">
|
---|
142 | <xsl:stylesheet version="1.0"><gsl:text>
|
---|
143 | </gsl:text>
|
---|
144 | <gsl:apply-templates
|
---|
145 | select="( xs:schema/xs:redefine | xs:schema/xs:include )[
|
---|
146 | ( xs:schema | xs:schema//xs:include/xs:schema |
|
---|
147 | xs:schema//xs:redefine/xs:schema ) /
|
---|
148 | xs:complexType or
|
---|
149 | ( xs:schema | xs:schema//xs:include/xs:schema |
|
---|
150 | xs:schema//xs:redefine/xs:schema ) /
|
---|
151 | xs:group[contains(@name,'.cnt')]]"
|
---|
152 | mode="make-transform"/>
|
---|
153 | <gsl:text>
|
---|
154 | </gsl:text>
|
---|
155 | <xsl:param name="REPORT_UNMATCHED" select="'yes'"/>
|
---|
156 | <xsl:param name="PROCESS_TEXT" select="'yes'"/>
|
---|
157 | <xsl:param name="PROCESS_CHILDREN" select="'yes'"/>
|
---|
158 | <gsl:text>
|
---|
159 | </gsl:text>
|
---|
160 | <xsl:template match="/">
|
---|
161 | <xsl:apply-templates select="." mode="topic.topic.in"/>
|
---|
162 | </xsl:template>
|
---|
163 | <gsl:text>
|
---|
164 | </gsl:text>
|
---|
165 | </xsl:stylesheet>
|
---|
166 | </gsl:template>
|
---|
167 |
|
---|
168 | <gsl:template match="xs:include|xs:redefine" mode="make-transform">
|
---|
169 | <gsl:variable name="fileroot">
|
---|
170 | <gsl:choose>
|
---|
171 | <gsl:when test="contains(@schemaLocation,'Mod.xsd')">
|
---|
172 | <gsl:value-of select="substring-before(@schemaLocation,'Mod.xsd')"/>
|
---|
173 | </gsl:when>
|
---|
174 | <gsl:otherwise>
|
---|
175 | <gsl:value-of select="substring-before(@schemaLocation,'.xsd')"/>
|
---|
176 | </gsl:otherwise>
|
---|
177 | </gsl:choose>
|
---|
178 | </gsl:variable>
|
---|
179 | <gsl:variable name="filename" select="concat($fileroot,'Output.xsl')"/>
|
---|
180 | <gsl:call-template name="writeout">
|
---|
181 | <gsl:with-param name="filename" select="$filename"/>
|
---|
182 | <gsl:with-param name="content">
|
---|
183 | <gsl:apply-templates select="xs:schema">
|
---|
184 | <gsl:with-param name="fileroot" select="$fileroot"/>
|
---|
185 | </gsl:apply-templates>
|
---|
186 | </gsl:with-param>
|
---|
187 | </gsl:call-template>
|
---|
188 | <xsl:import href="{$filename}"/><gsl:text>
|
---|
189 | </gsl:text>
|
---|
190 | </gsl:template>
|
---|
191 |
|
---|
192 | <gsl:template match="xs:schema">
|
---|
193 | <gsl:param name="fileroot"/>
|
---|
194 | <gsl:variable name="isTopic" select="boolean(
|
---|
195 | xs:complexType[@name='topic.class' or @name='map.class'])"/>
|
---|
196 | <gsl:variable name="typeDefs"
|
---|
197 | select="(. | .//xs:include/xs:schema | .//xs:redefine/xs:schema ) /
|
---|
198 | xs:complexType[generate-id(.)=generate-id(
|
---|
199 | key('typedef',substring-before(@name,'.class'))[1])]"/>
|
---|
200 | <gsl:variable name="groupDefs"
|
---|
201 | select="(. | .//xs:include/xs:schema | .//xs:redefine/xs:schema ) /
|
---|
202 | xs:group[contains(@name,'.cnt') and generate-id(.)=
|
---|
203 | generate-id(key('groupdef',@name)[1])]"/>
|
---|
204 | <gsl:variable name="attributeDefs"
|
---|
205 | select="//xs:attribute[
|
---|
206 | (@name and
|
---|
207 | @name!='xtrc' and @name!='xtrf' and
|
---|
208 | generate-id(.)=generate-id(key('attdef',@name)[1])) or
|
---|
209 | (@ref and
|
---|
210 | @ref!='xml:lang' and @ref!='xml:space' and
|
---|
211 | @ref!='class' and @ref!='ditaarch:DITAArchVersion' and
|
---|
212 | generate-id(.)=generate-id(key('attdef',@ref)[1]))]"/>
|
---|
213 | <xsl:stylesheet version="1.0">
|
---|
214 | <gsl:text>
|
---|
215 |
|
---|
216 | </gsl:text>
|
---|
217 | <gsl:comment>= = = ELEMENT OUTPUT RULES = = = = = = = = = =</gsl:comment>
|
---|
218 | <gsl:text>
|
---|
219 | </gsl:text>
|
---|
220 | <gsl:apply-templates select="$typeDefs" mode="out">
|
---|
221 | <gsl:sort select="@name"/>
|
---|
222 | </gsl:apply-templates>
|
---|
223 | <gsl:text>
|
---|
224 | </gsl:text>
|
---|
225 | <!-- define attributes only in the output for the base topic -->
|
---|
226 | <gsl:if test="$isTopic">
|
---|
227 | <gsl:comment>= = = ATTRIBUTE OUTPUT RULES = = = = = = = = =</gsl:comment>
|
---|
228 | <gsl:text>
|
---|
229 | </gsl:text>
|
---|
230 | <gsl:apply-templates select="$attributeDefs" mode="out">
|
---|
231 | <gsl:sort select="@name|@ref"/>
|
---|
232 | </gsl:apply-templates>
|
---|
233 | <gsl:text>
|
---|
234 | </gsl:text>
|
---|
235 | </gsl:if>
|
---|
236 | <gsl:text>
|
---|
237 | </gsl:text>
|
---|
238 | <gsl:comment>= = = DEFAULT ELEMENT INPUT RULES = = = = = = =</gsl:comment>
|
---|
239 | <gsl:text>
|
---|
240 | </gsl:text>
|
---|
241 | <gsl:apply-templates select="$typeDefs" mode="in">
|
---|
242 | <gsl:sort select="@name"/>
|
---|
243 | </gsl:apply-templates>
|
---|
244 | <gsl:text>
|
---|
245 | </gsl:text>
|
---|
246 | <gsl:if test="$groupDefs">
|
---|
247 | <gsl:comment>= = = DEFAULT CONTENT GROUP INPUT RULES = = = = = = =</gsl:comment>
|
---|
248 | <gsl:text>
|
---|
249 | </gsl:text>
|
---|
250 | <gsl:apply-templates select="$groupDefs" mode="in">
|
---|
251 | <gsl:sort select="@name"/>
|
---|
252 | </gsl:apply-templates>
|
---|
253 | <gsl:text>
|
---|
254 | </gsl:text>
|
---|
255 | </gsl:if>
|
---|
256 | <gsl:text>
|
---|
257 | </gsl:text>
|
---|
258 | <gsl:if test="$isTopic">
|
---|
259 | <gsl:comment>= = = DEFAULT ATTRIBUTE INPUT RULES = = = = = =</gsl:comment>
|
---|
260 | <gsl:text>
|
---|
261 | </gsl:text>
|
---|
262 | <gsl:apply-templates select="$attributeDefs" mode="in">
|
---|
263 | <gsl:sort select="@name|@ref"/>
|
---|
264 | </gsl:apply-templates>
|
---|
265 | <gsl:text>
|
---|
266 | </gsl:text>
|
---|
267 | </gsl:if>
|
---|
268 | <gsl:if test="$isTopic">
|
---|
269 | <gsl:text>
|
---|
270 | </gsl:text>
|
---|
271 | <gsl:comment>= = = DEFAULT RULES = = = = = = = = = = = = = =</gsl:comment>
|
---|
272 | <gsl:text>
|
---|
273 | </gsl:text>
|
---|
274 | <xsl:template match="*" mode="child">
|
---|
275 | <xsl:param name="container"/>
|
---|
276 | <xsl:param name="isRequired" select="'no'"/>
|
---|
277 | <xsl:call-template name="check.unmatched.child">
|
---|
278 | <xsl:with-param name="container" select="$container"/>
|
---|
279 | <xsl:with-param name="isRequired" select="$isRequired"/>
|
---|
280 | </xsl:call-template>
|
---|
281 | </xsl:template><gsl:text>
|
---|
282 | </gsl:text>
|
---|
283 | <xsl:template name="check.unmatched.child">
|
---|
284 | <xsl:param name="container"/>
|
---|
285 | <xsl:param name="isRequired" select="'no'"/>
|
---|
286 | <xsl:if test="$REPORT_UNMATCHED='yes'">
|
---|
287 | <xsl:comment>
|
---|
288 | <xsl:value-of select="name()"/>
|
---|
289 | <xsl:text> not processed within </xsl:text>
|
---|
290 | <xsl:value-of select="$container"/>
|
---|
291 | </xsl:comment>
|
---|
292 | </xsl:if>
|
---|
293 | <xsl:if test="$PROCESS_CHILDREN='yes'">
|
---|
294 | <xsl:apply-templates select="*|text()" mode="child"/>
|
---|
295 | </xsl:if>
|
---|
296 | </xsl:template><gsl:text>
|
---|
297 | </gsl:text>
|
---|
298 | <xsl:template match="text()" mode="child">
|
---|
299 | <xsl:param name="container"/>
|
---|
300 | <xsl:if test="$PROCESS_TEXT='yes'">
|
---|
301 | <xsl:copy-of select="."/>
|
---|
302 | </xsl:if>
|
---|
303 | </xsl:template><gsl:text>
|
---|
304 | </gsl:text>
|
---|
305 | <xsl:template name="check.unsupplied.input">
|
---|
306 | <xsl:param name="input"/>
|
---|
307 | <xsl:param name="container"/>
|
---|
308 | <xsl:param name="isRequired" select="'no'"/>
|
---|
309 | <xsl:if test="$isRequired='yes'">
|
---|
310 | <xsl:message>
|
---|
311 | <xsl:text>required </xsl:text>
|
---|
312 | <xsl:value-of select="$input"/>
|
---|
313 | <xsl:text> not supplied within </xsl:text>
|
---|
314 | <xsl:value-of select="$container"/>
|
---|
315 | </xsl:message>
|
---|
316 | </xsl:if>
|
---|
317 | <xsl:if test="$isRequired='yes' or $REPORT_UNMATCHED='yes'">
|
---|
318 | <xsl:comment>
|
---|
319 | <xsl:value-of select="$input"/>
|
---|
320 | <xsl:text> not supplied within </xsl:text>
|
---|
321 | <xsl:value-of select="$container"/>
|
---|
322 | </xsl:comment>
|
---|
323 | </xsl:if>
|
---|
324 | </xsl:template><gsl:text>
|
---|
325 | </gsl:text>
|
---|
326 | </gsl:if>
|
---|
327 | </xsl:stylesheet>
|
---|
328 | </gsl:template>
|
---|
329 |
|
---|
330 | <gsl:template match="xs:complexType" mode="out">
|
---|
331 | <gsl:variable name="type" select="substring-before(@name,'.class')"/>
|
---|
332 | <gsl:variable name="module">
|
---|
333 | <gsl:apply-templates select="xs:attribute[@ref='class']" mode="package">
|
---|
334 | <gsl:with-param name="type" select="$type"/>
|
---|
335 | </gsl:apply-templates>
|
---|
336 | </gsl:variable>
|
---|
337 | <xsl:template match="*" mode="{$module}.{$type}.in">
|
---|
338 | <xsl:param name="container"/>
|
---|
339 | <xsl:param name="isRequired" select="'no'"/>
|
---|
340 | <xsl:call-template name="check.unsupplied.input">
|
---|
341 | <xsl:with-param name="container" select="$container"/>
|
---|
342 | <xsl:with-param name="isRequired" select="$isRequired"/>
|
---|
343 | <xsl:with-param name="input" select="' {$module}/{$type} '"/>
|
---|
344 | </xsl:call-template>
|
---|
345 | </xsl:template><gsl:text>
|
---|
346 | </gsl:text>
|
---|
347 | <xsl:template match="*" mode="{$module}.{$type}.out">
|
---|
348 | <gsl:element name="{$type}">
|
---|
349 | <gsl:if test="xs:attributeGroup[not(@name) or @name!='global-atts'] |
|
---|
350 | xs:attribute[(not(@ref) or
|
---|
351 | (@ref!='xml:lang' and @ref!='xml:space' and
|
---|
352 | @ref!='class' and @ref!='ditaarch:DITAArchVersion')) and
|
---|
353 | (not(@name) or @name!='translate')]">
|
---|
354 | <xsl:apply-templates select="." mode="{$module}.{$type}.atts.in"/>
|
---|
355 | </gsl:if>
|
---|
356 | <gsl:if test="xs:sequence|xs:choice|xs:group|self::*[@mixed='true']">
|
---|
357 | <xsl:apply-templates select="." mode="{$module}.{$type}.content.in"/>
|
---|
358 | </gsl:if>
|
---|
359 | </gsl:element>
|
---|
360 | </xsl:template><gsl:text>
|
---|
361 | </gsl:text>
|
---|
362 | </gsl:template>
|
---|
363 |
|
---|
364 | <gsl:template match="xs:complexType" mode="in">
|
---|
365 | <gsl:variable name="type" select="substring-before(@name,'.class')"/>
|
---|
366 | <gsl:variable name="module">
|
---|
367 | <gsl:apply-templates select="xs:attribute[@ref='class']" mode="package">
|
---|
368 | <gsl:with-param name="type" select="$type"/>
|
---|
369 | </gsl:apply-templates>
|
---|
370 | </gsl:variable>
|
---|
371 | <gsl:if test="xs:attributeGroup[not(@name) or @name!='global-atts'] |
|
---|
372 | xs:attribute[(not(@ref) or
|
---|
373 | (@ref!='xml:lang' and @ref!='xml:space' and
|
---|
374 | @ref!='class' and @ref!='ditaarch:DITAArchVersion')) and
|
---|
375 | (not(@name) or @name!='translate')]">
|
---|
376 | <xsl:template match="*" mode="{$module}.{$type}.atts.in">
|
---|
377 | <gsl:if test="contains(concat(xs:attribute[@ref='class']/@default,' '),
|
---|
378 | '/topic ')">
|
---|
379 | <xsl:attribute name="xml:lang">
|
---|
380 | <xsl:text>en-us</xsl:text>
|
---|
381 | </xsl:attribute>
|
---|
382 | </gsl:if>
|
---|
383 | <gsl:apply-templates select="xs:attributeGroup" mode="in.fire">
|
---|
384 | <gsl:with-param name="module" select="$module"/>
|
---|
385 | <gsl:with-param name="type" select="$type"/>
|
---|
386 | </gsl:apply-templates>
|
---|
387 | <gsl:apply-templates select="xs:attribute" mode="in.fire">
|
---|
388 | <gsl:with-param name="module" select="$module"/>
|
---|
389 | <gsl:with-param name="type" select="$type"/>
|
---|
390 | </gsl:apply-templates>
|
---|
391 | </xsl:template><gsl:text>
|
---|
392 | </gsl:text>
|
---|
393 | <gsl:apply-templates select="xs:attributeGroup" mode="in.handle">
|
---|
394 | <gsl:with-param name="module" select="$module"/>
|
---|
395 | <gsl:with-param name="type" select="$type"/>
|
---|
396 | </gsl:apply-templates>
|
---|
397 | <gsl:apply-templates select="xs:attribute" mode="in.handle">
|
---|
398 | <gsl:with-param name="module" select="$module"/>
|
---|
399 | <gsl:with-param name="type" select="$type"/>
|
---|
400 | </gsl:apply-templates>
|
---|
401 | </gsl:if>
|
---|
402 | <gsl:if test="xs:sequence or xs:choice or xs:group or
|
---|
403 | self::*[@mixed='true']">
|
---|
404 | <gsl:variable name="isContentGroup"
|
---|
405 | select="boolean(xs:choice and count(xs:choice/*)=1 and
|
---|
406 | xs:choice/xs:group[contains(@ref,'.cnt')])"/>
|
---|
407 | <gsl:choose>
|
---|
408 | <gsl:when test="@mixed='true' and $isContentGroup">
|
---|
409 | <gsl:apply-templates select="." mode="group.fire.handle">
|
---|
410 | <gsl:with-param name="module" select="$module"/>
|
---|
411 | <gsl:with-param name="type" select="$type"/>
|
---|
412 | <gsl:with-param name="isText" select="'yes'"/>
|
---|
413 | </gsl:apply-templates>
|
---|
414 | </gsl:when>
|
---|
415 | <gsl:when test="@mixed='true'">
|
---|
416 | <gsl:apply-templates select="." mode="content.child">
|
---|
417 | <gsl:with-param name="module" select="$module"/>
|
---|
418 | <gsl:with-param name="type" select="$type"/>
|
---|
419 | <gsl:with-param name="childlist" select="'*|text()'"/>
|
---|
420 | </gsl:apply-templates>
|
---|
421 | </gsl:when>
|
---|
422 | <gsl:when test="$isContentGroup">
|
---|
423 | <gsl:apply-templates select="." mode="group.fire.handle">
|
---|
424 | <gsl:with-param name="module" select="$module"/>
|
---|
425 | <gsl:with-param name="type" select="$type"/>
|
---|
426 | <gsl:with-param name="isText" select="'no'"/>
|
---|
427 | </gsl:apply-templates>
|
---|
428 | </gsl:when>
|
---|
429 | <gsl:when test="xs:sequence/xs:choice or xs:choice/xs:sequence">
|
---|
430 | <gsl:apply-templates select="." mode="content.child">
|
---|
431 | <gsl:with-param name="module" select="$module"/>
|
---|
432 | <gsl:with-param name="type" select="$type"/>
|
---|
433 | <gsl:with-param name="childlist" select="'*'"/>
|
---|
434 | </gsl:apply-templates>
|
---|
435 | </gsl:when>
|
---|
436 | <gsl:when test="xs:sequence">
|
---|
437 | <xsl:template match="*" mode="{$module}.{$type}.content.in">
|
---|
438 | <gsl:apply-templates select="xs:sequence/*" mode="pull.in.fire">
|
---|
439 | <gsl:with-param name="module" select="$module"/>
|
---|
440 | <gsl:with-param name="type" select="$type"/>
|
---|
441 | </gsl:apply-templates>
|
---|
442 | </xsl:template><gsl:text>
|
---|
443 | </gsl:text>
|
---|
444 | <gsl:apply-templates select="xs:sequence/*" mode="pull.in.handle">
|
---|
445 | <gsl:with-param name="module" select="$module"/>
|
---|
446 | <gsl:with-param name="type" select="$type"/>
|
---|
447 | </gsl:apply-templates>
|
---|
448 | </gsl:when>
|
---|
449 | <gsl:when test="xs:choice and count(xs:choice/*)=1">
|
---|
450 | <xsl:template match="*" mode="{$module}.{$type}.content.in">
|
---|
451 | <gsl:apply-templates select="xs:choice/*" mode="pull.in.fire">
|
---|
452 | <gsl:with-param name="module" select="$module"/>
|
---|
453 | <gsl:with-param name="type" select="$type"/>
|
---|
454 | </gsl:apply-templates>
|
---|
455 | </xsl:template><gsl:text>
|
---|
456 | </gsl:text>
|
---|
457 | <gsl:apply-templates select="xs:choice/*" mode="pull.in.handle">
|
---|
458 | <gsl:with-param name="module" select="$module"/>
|
---|
459 | <gsl:with-param name="type" select="$type"/>
|
---|
460 | </gsl:apply-templates>
|
---|
461 | </gsl:when>
|
---|
462 | <gsl:otherwise>
|
---|
463 | <gsl:apply-templates select="." mode="content.child">
|
---|
464 | <gsl:with-param name="module" select="$module"/>
|
---|
465 | <gsl:with-param name="type" select="$type"/>
|
---|
466 | <gsl:with-param name="childlist" select="'*'"/>
|
---|
467 | </gsl:apply-templates>
|
---|
468 | </gsl:otherwise>
|
---|
469 | </gsl:choose>
|
---|
470 | </gsl:if>
|
---|
471 | </gsl:template>
|
---|
472 |
|
---|
473 | <gsl:template match="xs:group[contains(@name,'.cnt')]" mode="in">
|
---|
474 | <gsl:variable name="typemodule">
|
---|
475 | <gsl:apply-templates
|
---|
476 | select="key('typedef',@ref)[1]/xs:attribute[@ref='class']"
|
---|
477 | mode="package">
|
---|
478 | <gsl:with-param name="type" select="@ref"/>
|
---|
479 | </gsl:apply-templates>
|
---|
480 | </gsl:variable>
|
---|
481 | <gsl:choose>
|
---|
482 | <gsl:when test="xs:sequence">
|
---|
483 | <xsl:template match="*" mode="{@name}.in">
|
---|
484 | <xsl:param name="container"/>
|
---|
485 | <xsl:param name="isRequired" select="'no'"/>
|
---|
486 | <gsl:apply-templates select="xs:sequence/*" mode="global.in.fire">
|
---|
487 | <gsl:with-param name="container" select="'$container'"/>
|
---|
488 | <gsl:with-param name="isRequired" select="'$isRequired'"/>
|
---|
489 | <gsl:with-param name="typemodule" select="$typemodule"/>
|
---|
490 | </gsl:apply-templates>
|
---|
491 | </xsl:template><gsl:text>
|
---|
492 | </gsl:text>
|
---|
493 | </gsl:when>
|
---|
494 | <gsl:when test="xs:choice">
|
---|
495 | <xsl:template match="*" mode="{@name}.in">
|
---|
496 | <xsl:param name="container"/>
|
---|
497 | <xsl:param name="isRequired" select="'no'"/>
|
---|
498 | <xsl:apply-templates select="*" mode="{@name}.child">
|
---|
499 | <xsl:with-param name="container" select="$container"/>
|
---|
500 | <xsl:with-param name="isRequired" select="$isRequired"/>
|
---|
501 | </xsl:apply-templates>
|
---|
502 | </xsl:template><gsl:text>
|
---|
503 | </gsl:text>
|
---|
504 | <xsl:template match="*" mode="{@name}.text.in">
|
---|
505 | <xsl:param name="container"/>
|
---|
506 | <xsl:apply-templates select="*|text()" mode="{@name}.child">
|
---|
507 | <xsl:with-param name="container" select="$container"/>
|
---|
508 | <xsl:with-param name="isRequired" select="'no'"/>
|
---|
509 | </xsl:apply-templates>
|
---|
510 | </xsl:template><gsl:text>
|
---|
511 | </gsl:text>
|
---|
512 | <xsl:template match="*|text()" mode="{@name}.child">
|
---|
513 | <xsl:param name="container"/>
|
---|
514 | <xsl:param name="isRequired" select="'no'"/>
|
---|
515 | <xsl:apply-templates select="." mode="child">
|
---|
516 | <xsl:with-param name="container" select="$container"/>
|
---|
517 | <xsl:with-param name="isRequired" select="$isRequired"/>
|
---|
518 | </xsl:apply-templates>
|
---|
519 | </xsl:template><gsl:text>
|
---|
520 | </gsl:text>
|
---|
521 | </gsl:when>
|
---|
522 | <gsl:otherwise>
|
---|
523 | <xsl:message>Unknown content model for content group</xsl:message>
|
---|
524 | </gsl:otherwise>
|
---|
525 | </gsl:choose>
|
---|
526 | </gsl:template>
|
---|
527 |
|
---|
528 | <gsl:template match="xs:attributeGroup[@name='global-atts']" mode="out"/>
|
---|
529 |
|
---|
530 | <gsl:template match="xs:attributeGroup" mode="out">
|
---|
531 | <gsl:param name="module"/>
|
---|
532 | <gsl:variable name="group">
|
---|
533 | <gsl:choose>
|
---|
534 | <gsl:when test="contains(@name,'-atts')">
|
---|
535 | <gsl:value-of
|
---|
536 | select="concat(substring-before(@name,'-atts'),'.atts')"/>
|
---|
537 | </gsl:when>
|
---|
538 | <gsl:otherwise>
|
---|
539 | <gsl:value-of select="@name"/>
|
---|
540 | </gsl:otherwise>
|
---|
541 | </gsl:choose>
|
---|
542 | </gsl:variable>
|
---|
543 | <xsl:template match="*" mode="{$module}.{$group}.in">
|
---|
544 | <xsl:param name="container"/>
|
---|
545 | <gsl:apply-templates select="xs:attributeGroup|xs:attribute" mode="base">
|
---|
546 | <gsl:with-param name="module" select="$module"/>
|
---|
547 | </gsl:apply-templates>
|
---|
548 | </xsl:template><gsl:text>
|
---|
549 | </gsl:text>
|
---|
550 | </gsl:template>
|
---|
551 |
|
---|
552 | <gsl:template match="xs:attribute" mode="out">
|
---|
553 | <gsl:variable name="attname" select="@name|@ref"/>
|
---|
554 | <xsl:template match="*" mode="{$attname}.att.out">
|
---|
555 | <xsl:param name="value"/>
|
---|
556 | <xsl:attribute name="{$attname}">
|
---|
557 | <xsl:value-of select="$value"/>
|
---|
558 | </xsl:attribute>
|
---|
559 | </xsl:template><gsl:text>
|
---|
560 | </gsl:text>
|
---|
561 | </gsl:template>
|
---|
562 |
|
---|
563 | <gsl:template match="xs:attribute" mode="in">
|
---|
564 | <gsl:variable name="attname" select="@name|@ref"/>
|
---|
565 | <xsl:template match="*" mode="{$attname}.att.in">
|
---|
566 | <xsl:param name="isRequired" select="'no'"/>
|
---|
567 | <xsl:param name="container"/>
|
---|
568 | </xsl:template><gsl:text>
|
---|
569 | </gsl:text>
|
---|
570 | </gsl:template>
|
---|
571 |
|
---|
572 | <gsl:template match="xs:sequence" mode="out">
|
---|
573 | <gsl:message>match="xs:sequence" mode="out" shouldn't fire</gsl:message>
|
---|
574 | </gsl:template>
|
---|
575 |
|
---|
576 | <gsl:template match="xs:group[@ref='info-types']" mode="pull.in.fire">
|
---|
577 | <gsl:param name="module"/>
|
---|
578 | <gsl:param name="type"/>
|
---|
579 | <!--SHOULDN'T BE HARD CODED TO TOPIC-->
|
---|
580 | <xsl:apply-templates select="." mode="{$module}.{$type}.topic.topic.in"/>
|
---|
581 | </gsl:template>
|
---|
582 |
|
---|
583 | <gsl:template match="xs:group[@ref='info-types']" mode="pull.in.handle">
|
---|
584 | <gsl:param name="module"/>
|
---|
585 | <gsl:param name="type"/>
|
---|
586 | <!--SHOULDN'T BE HARD CODED TO TOPIC-->
|
---|
587 | <xsl:template match="*" mode="{$module}.{$type}.topic.topic.in">
|
---|
588 | <xsl:apply-templates select="." mode="topic.topic.in">
|
---|
589 | <xsl:with-param name="container" select="' {$module}/{$type} '"/>
|
---|
590 | </xsl:apply-templates>
|
---|
591 | </xsl:template><gsl:text>
|
---|
592 | </gsl:text>
|
---|
593 | </gsl:template>
|
---|
594 |
|
---|
595 | <gsl:template match="xs:group[@ref and @ref!='info-types' and
|
---|
596 | not(contains(@ref,'.cnt'))]|xs:element[@ref]"
|
---|
597 | mode="pull.in.fire">
|
---|
598 | <gsl:param name="module"/>
|
---|
599 | <gsl:param name="type"/>
|
---|
600 | <gsl:variable name="typemodule">
|
---|
601 | <gsl:apply-templates
|
---|
602 | select="key('typedef',@ref)[1]/xs:attribute[@ref='class']"
|
---|
603 | mode="package">
|
---|
604 | <gsl:with-param name="type" select="@ref"/>
|
---|
605 | </gsl:apply-templates>
|
---|
606 | </gsl:variable>
|
---|
607 | <gsl:choose>
|
---|
608 | <gsl:when test="$typemodule and $typemodule!=''">
|
---|
609 | <xsl:apply-templates select="."
|
---|
610 | mode="{$module}.{$type}.{$typemodule}.{@ref}.in"/>
|
---|
611 | </gsl:when>
|
---|
612 | <gsl:otherwise>
|
---|
613 | <gsl:comment>COULD NOT DETERMINE MODULE TO FIRE TYPE</gsl:comment>
|
---|
614 | </gsl:otherwise>
|
---|
615 | </gsl:choose>
|
---|
616 | </gsl:template>
|
---|
617 |
|
---|
618 | <gsl:template match="xs:group[@ref and @ref!='info-types' and
|
---|
619 | not(contains(@ref,'.cnt'))]|xs:element[@ref]"
|
---|
620 | mode="global.in.fire">
|
---|
621 | <gsl:param name="container"/>
|
---|
622 | <gsl:param name="isRequired" select="'no'"/>
|
---|
623 | <gsl:param name="typemodule">
|
---|
624 | <gsl:apply-templates
|
---|
625 | select="key('typedef',@ref)[1]/xs:attribute[@ref='class']"
|
---|
626 | mode="package">
|
---|
627 | <gsl:with-param name="type" select="@ref"/>
|
---|
628 | </gsl:apply-templates>
|
---|
629 | </gsl:param>
|
---|
630 | <gsl:choose>
|
---|
631 | <gsl:when test="$typemodule and $typemodule!=''">
|
---|
632 | <xsl:apply-templates select="." mode="{$typemodule}.{@ref}.in">
|
---|
633 | <xsl:with-param name="isRequired" select="'{$isRequired}'"/>
|
---|
634 | <xsl:with-param name="container" select="'{$container}'"/>
|
---|
635 | </xsl:apply-templates>
|
---|
636 | </gsl:when>
|
---|
637 | <gsl:otherwise>
|
---|
638 | <gsl:comment>COULD NOT DETERMINE MODULE TO FIRE TYPE GLOBALLY</gsl:comment>
|
---|
639 | </gsl:otherwise>
|
---|
640 | </gsl:choose>
|
---|
641 | </gsl:template>
|
---|
642 |
|
---|
643 | <gsl:template match="xs:group[@ref and @ref!='info-types' and
|
---|
644 | not(contains(@ref,'.cnt'))]|xs:element[@ref]"
|
---|
645 | mode="pull.in.handle">
|
---|
646 | <gsl:param name="module"/>
|
---|
647 | <gsl:param name="type"/>
|
---|
648 | <gsl:param name="typemodule">
|
---|
649 | <gsl:apply-templates
|
---|
650 | select="key('typedef',@ref)[1]/xs:attribute[@ref='class']"
|
---|
651 | mode="package">
|
---|
652 | <gsl:with-param name="type" select="@ref"/>
|
---|
653 | </gsl:apply-templates>
|
---|
654 | </gsl:param>
|
---|
655 | <gsl:variable name="minOccurs" select="(.|..)/@minOccurs[1]"/>
|
---|
656 | <gsl:variable name="isRequired">
|
---|
657 | <gsl:choose>
|
---|
658 | <gsl:when test="not($minOccurs) or $minOccurs='1'">
|
---|
659 | <gsl:text>yes</gsl:text>
|
---|
660 | </gsl:when>
|
---|
661 | <gsl:otherwise>
|
---|
662 | <gsl:text>no</gsl:text>
|
---|
663 | </gsl:otherwise>
|
---|
664 | </gsl:choose>
|
---|
665 | </gsl:variable>
|
---|
666 | <gsl:choose>
|
---|
667 | <gsl:when test="$typemodule and $typemodule!=''">
|
---|
668 | <xsl:template match="*" mode="{$module}.{$type}.{$typemodule}.{@ref}.in">
|
---|
669 | <gsl:apply-templates select="." mode="global.in.fire">
|
---|
670 | <gsl:with-param name="isRequired" select="$isRequired"/>
|
---|
671 | <gsl:with-param name="container"
|
---|
672 | select="concat(' ',$module,'/',$type,' ')"/>
|
---|
673 | <gsl:with-param name="typemodule" select="$typemodule"/>
|
---|
674 | </gsl:apply-templates>
|
---|
675 | </xsl:template><gsl:text>
|
---|
676 | </gsl:text>
|
---|
677 | </gsl:when>
|
---|
678 | <gsl:otherwise>
|
---|
679 | <gsl:comment>COULD NOT DETERMINE MODULE TO HANDLE TYPE</gsl:comment>
|
---|
680 | </gsl:otherwise>
|
---|
681 | </gsl:choose>
|
---|
682 | </gsl:template>
|
---|
683 |
|
---|
684 | <gsl:template match="xs:group[@ref and @ref!='info-types' and
|
---|
685 | contains(@ref,'.cnt')]"
|
---|
686 | mode="group.in.fire">
|
---|
687 | <gsl:param name="module"/>
|
---|
688 | <gsl:param name="type"/>
|
---|
689 | <gsl:param name="isText" select="'yes'"/>
|
---|
690 | <gsl:choose>
|
---|
691 | <gsl:when test="$isText='yes'">
|
---|
692 | <xsl:apply-templates select="." mode="{@ref}.text.in"/>
|
---|
693 | </gsl:when>
|
---|
694 | <gsl:otherwise>
|
---|
695 | <xsl:apply-templates select="." mode="{@ref}.in"/>
|
---|
696 | </gsl:otherwise>
|
---|
697 | </gsl:choose>
|
---|
698 | </gsl:template>
|
---|
699 |
|
---|
700 | <gsl:template match="*" mode="content.child">
|
---|
701 | <gsl:param name="module"/>
|
---|
702 | <gsl:param name="type"/>
|
---|
703 | <gsl:param name="childlist" select="'*|text()'"/>
|
---|
704 | <xsl:template match="*" mode="{$module}.{$type}.content.in">
|
---|
705 | <xsl:apply-templates select="{$childlist}"
|
---|
706 | mode="{$module}.{$type}.child"/>
|
---|
707 | </xsl:template><gsl:text>
|
---|
708 | </gsl:text>
|
---|
709 | <gsl:apply-templates select="." mode="child.in.handle">
|
---|
710 | <gsl:with-param name="module" select="$module"/>
|
---|
711 | <gsl:with-param name="type" select="$type"/>
|
---|
712 | <gsl:with-param name="childlist" select="$childlist"/>
|
---|
713 | </gsl:apply-templates>
|
---|
714 | </gsl:template>
|
---|
715 |
|
---|
716 | <gsl:template match="*" mode="child.in.handle">
|
---|
717 | <gsl:param name="module"/>
|
---|
718 | <gsl:param name="type"/>
|
---|
719 | <gsl:param name="childlist" select="'*|text()'"/>
|
---|
720 | <xsl:template match="{$childlist}" mode="{$module}.{$type}.child">
|
---|
721 | <xsl:param name="isRequired" select="'no'"/>
|
---|
722 | <xsl:apply-templates select="." mode="child">
|
---|
723 | <xsl:with-param name="container" select="' {$module}/{$type} '"/>
|
---|
724 | <xsl:with-param name="isRequired" select="$isRequired"/>
|
---|
725 | </xsl:apply-templates>
|
---|
726 | </xsl:template><gsl:text>
|
---|
727 | </gsl:text>
|
---|
728 | </gsl:template>
|
---|
729 |
|
---|
730 | <gsl:template match="*" mode="group.fire.handle">
|
---|
731 | <gsl:param name="module"/>
|
---|
732 | <gsl:param name="type"/>
|
---|
733 | <gsl:param name="isText" select="'yes'"/>
|
---|
734 | <xsl:template match="*" mode="{$module}.{$type}.content.in">
|
---|
735 | <gsl:apply-templates select="xs:choice/*" mode="group.in.fire">
|
---|
736 | <gsl:with-param name="module" select="$module"/>
|
---|
737 | <gsl:with-param name="type" select="$type"/>
|
---|
738 | <gsl:with-param name="isText" select="$isText"/>
|
---|
739 | </gsl:apply-templates>
|
---|
740 | </xsl:template><gsl:text>
|
---|
741 | </gsl:text>
|
---|
742 | </gsl:template>
|
---|
743 |
|
---|
744 | <gsl:template match="xs:group" name="typeout" mode="out">
|
---|
745 | <gsl:param name="module"/>
|
---|
746 | <gsl:param name="type"/>
|
---|
747 | <gsl:param name="subtype" select="@ref"/>
|
---|
748 | <xsl:apply-templates select="." mode="{$module}.{$subtype}.in">
|
---|
749 | <xsl:with-param name="container" select="' {$module}/{$type} '"/>
|
---|
750 | </xsl:apply-templates>
|
---|
751 | </gsl:template>
|
---|
752 |
|
---|
753 | <gsl:template match="xs:attributeGroup[contains(@ref,'-atts')]">
|
---|
754 | <gsl:message>match="xs:attributeGroup[contains(@ref,'-atts')]" shouldn't fire</gsl:message>
|
---|
755 | </gsl:template>
|
---|
756 |
|
---|
757 | <gsl:template match="xs:attributeGroup[@name='global-atts']" mode="in.fire"/>
|
---|
758 | <gsl:template match="xs:attributeGroup[@name='global-atts']" mode="in.handle"/>
|
---|
759 |
|
---|
760 | <gsl:template match="xs:attributeGroup[contains(@ref,'-atts')]" mode="in.fire">
|
---|
761 | <gsl:param name="module"/>
|
---|
762 | <gsl:param name="type"/>
|
---|
763 | <gsl:if test="@ref!='global-atts'">
|
---|
764 | <gsl:call-template name="attgroup">
|
---|
765 | <gsl:with-param name="module" select="$module"/>
|
---|
766 | <gsl:with-param name="type" select="$type"/>
|
---|
767 | <gsl:with-param name="attgroup"
|
---|
768 | select="concat(substring-before(@ref,'-atts'),'.atts')"/>
|
---|
769 | </gsl:call-template>
|
---|
770 | </gsl:if>
|
---|
771 | </gsl:template>
|
---|
772 |
|
---|
773 | <gsl:template match="xs:attributeGroup[contains(@ref,'-atts')]"
|
---|
774 | mode="in.handle">
|
---|
775 | <gsl:param name="module"/>
|
---|
776 | <gsl:param name="type"/>
|
---|
777 | <gsl:if test="@ref!='global-atts'">
|
---|
778 | <gsl:call-template name="attgroupHandle">
|
---|
779 | <gsl:with-param name="module" select="$module"/>
|
---|
780 | <gsl:with-param name="type" select="$type"/>
|
---|
781 | <gsl:with-param name="attgroup"
|
---|
782 | select="concat(substring-before(@ref,'-atts'),'.atts')"/>
|
---|
783 | </gsl:call-template>
|
---|
784 | </gsl:if>
|
---|
785 | </gsl:template>
|
---|
786 |
|
---|
787 | <gsl:template match="xs:attributeGroup">
|
---|
788 | <gsl:message>match="xs:attributeGroup" shouldn't fire</gsl:message>
|
---|
789 | </gsl:template>
|
---|
790 |
|
---|
791 | <gsl:template match="xs:attributeGroup" name="attgroup" mode="in.fire">
|
---|
792 | <gsl:param name="module"/>
|
---|
793 | <gsl:param name="type"/>
|
---|
794 | <gsl:param name="attgroup" select="@ref"/>
|
---|
795 | <xsl:apply-templates select="." mode="{$module}.{$type}.{$attgroup}.in"/>
|
---|
796 | </gsl:template>
|
---|
797 |
|
---|
798 | <gsl:template match="xs:attributeGroup" name="attgroupHandle" mode="in.handle">
|
---|
799 | <gsl:param name="module"/>
|
---|
800 | <gsl:param name="type"/>
|
---|
801 | <gsl:param name="attgroup" select="@ref"/>
|
---|
802 | <gsl:variable name="attgroupdef" select="key('attgroupdef',@ref)[1]"/>
|
---|
803 | <xsl:template match="*" mode="{$module}.{$type}.{$attgroup}.in">
|
---|
804 | <gsl:apply-templates select="$attgroupdef/xs:attributeGroup"
|
---|
805 | mode="in.fire">
|
---|
806 | <gsl:with-param name="module" select="$module"/>
|
---|
807 | <gsl:with-param name="type" select="$type"/>
|
---|
808 | </gsl:apply-templates>
|
---|
809 | <gsl:apply-templates select="$attgroupdef/xs:attribute" mode="in.fire">
|
---|
810 | <gsl:with-param name="module" select="$module"/>
|
---|
811 | <gsl:with-param name="type" select="$type"/>
|
---|
812 | </gsl:apply-templates>
|
---|
813 | </xsl:template><gsl:text>
|
---|
814 | </gsl:text>
|
---|
815 | <gsl:apply-templates select="$attgroupdef/xs:attributeGroup"
|
---|
816 | mode="in.handle">
|
---|
817 | <gsl:with-param name="module" select="$module"/>
|
---|
818 | <gsl:with-param name="type" select="$type"/>
|
---|
819 | </gsl:apply-templates>
|
---|
820 | <gsl:apply-templates select="$attgroupdef/xs:attribute" mode="in.handle">
|
---|
821 | <gsl:with-param name="module" select="$module"/>
|
---|
822 | <gsl:with-param name="type" select="$type"/>
|
---|
823 | </gsl:apply-templates>
|
---|
824 | </gsl:template>
|
---|
825 |
|
---|
826 | <gsl:template match="xs:attributeGroup[contains(@ref,'-atts')]" mode="base">
|
---|
827 | <gsl:param name="module"/>
|
---|
828 | <gsl:if test="@ref!='global-atts'">
|
---|
829 | <gsl:call-template name="baseattgroup">
|
---|
830 | <gsl:with-param name="module" select="$module"/>
|
---|
831 | <gsl:with-param name="attgroup"
|
---|
832 | select="concat(substring-before(@ref,'-atts'),'.atts')"/>
|
---|
833 | </gsl:call-template>
|
---|
834 | </gsl:if>
|
---|
835 | </gsl:template>
|
---|
836 |
|
---|
837 | <gsl:template match="xs:attributeGroup" name="baseattgroup" mode="base">
|
---|
838 | <gsl:param name="module"/>
|
---|
839 | <gsl:param name="attgroup" select="@ref"/>
|
---|
840 | <xsl:apply-templates select="." mode="{$module}.{$attgroup}.in">
|
---|
841 | <xsl:with-param name="container" select="$container"/>
|
---|
842 | </xsl:apply-templates>
|
---|
843 | </gsl:template>
|
---|
844 |
|
---|
845 | <gsl:template match="xs:attribute[@ref='xml:lang' or @name='translate' or
|
---|
846 | @ref='xml:space' or
|
---|
847 | @ref='class' or @ref='ditaarch:DITAArchVersion']" mode="in.fire"/>
|
---|
848 |
|
---|
849 | <gsl:template match="xs:attribute[@ref='xml:lang' or @name='translate' or
|
---|
850 | @ref='xml:space' or
|
---|
851 | @ref='class' or @ref='ditaarch:DITAArchVersion']" mode="in.handle"/>
|
---|
852 |
|
---|
853 | <gsl:template match="xs:attribute">
|
---|
854 | <gsl:message>match="xs:attribute" shouldn't fire</gsl:message>
|
---|
855 | </gsl:template>
|
---|
856 |
|
---|
857 | <gsl:template match="xs:attribute" mode="in.fire">
|
---|
858 | <gsl:param name="module"/>
|
---|
859 | <gsl:param name="type"/>
|
---|
860 | <xsl:apply-templates select="."
|
---|
861 | mode="{$module}.{$type}.{@ref|@name}.att.in"/>
|
---|
862 | </gsl:template>
|
---|
863 |
|
---|
864 | <gsl:template match="xs:attribute" mode="in.handle">
|
---|
865 | <gsl:param name="module"/>
|
---|
866 | <gsl:param name="type"/>
|
---|
867 | <gsl:variable name="isRequired">
|
---|
868 | <gsl:choose>
|
---|
869 | <gsl:when test="@use and @use='required'">
|
---|
870 | <gsl:text>yes</gsl:text>
|
---|
871 | </gsl:when>
|
---|
872 | <gsl:otherwise>
|
---|
873 | <gsl:text>no</gsl:text>
|
---|
874 | </gsl:otherwise>
|
---|
875 | </gsl:choose>
|
---|
876 | </gsl:variable>
|
---|
877 | <xsl:template match="*" mode="{$module}.{$type}.{@ref|@name}.att.in">
|
---|
878 | <xsl:apply-templates select="." mode="{@ref|@name}.att.in">
|
---|
879 | <xsl:with-param name="isRequired" select="'{$isRequired}'"/>
|
---|
880 | </xsl:apply-templates>
|
---|
881 | </xsl:template><gsl:text>
|
---|
882 | </gsl:text>
|
---|
883 | </gsl:template>
|
---|
884 |
|
---|
885 | <gsl:template match="xs:attribute[@ref='xml:lang' or @name='translate' or
|
---|
886 | @ref='xml:space' or
|
---|
887 | @ref='class' or @ref='ditaarch:DITAArchVersion']" mode="base"/>
|
---|
888 |
|
---|
889 | <gsl:template match="xs:attribute" mode="base">
|
---|
890 | <gsl:param name="module"/>
|
---|
891 | <xsl:apply-templates select="." mode="{$module}.{@ref|@name}.att.in">
|
---|
892 | <xsl:with-param name="container" select="$container"/>
|
---|
893 | </xsl:apply-templates>
|
---|
894 | </gsl:template>
|
---|
895 |
|
---|
896 | <gsl:template match="xs:attribute[@ref='class']" mode="package">
|
---|
897 | <gsl:param name="type"/>
|
---|
898 | <gsl:variable name="value" select="
|
---|
899 | normalize-space(
|
---|
900 | substring-before(concat(@default,' '),
|
---|
901 | concat('/',$type,' ')
|
---|
902 | )
|
---|
903 | )"/>
|
---|
904 | <gsl:call-template name="get-last-token">
|
---|
905 | <gsl:with-param name="value" select="$value"/>
|
---|
906 | </gsl:call-template>
|
---|
907 | </gsl:template>
|
---|
908 |
|
---|
909 | <gsl:template name="get-last-token">
|
---|
910 | <gsl:param name="value"/>
|
---|
911 | <gsl:param name="delimiter" select="' '"/>
|
---|
912 | <gsl:variable name="nextvalue" select="substring-after($value, $delimiter)"/>
|
---|
913 | <gsl:choose>
|
---|
914 | <gsl:when test="$nextvalue and $nextvalue!=''">
|
---|
915 | <gsl:call-template name="get-last-token">
|
---|
916 | <gsl:with-param name="value" select="$nextvalue"/>
|
---|
917 | <gsl:with-param name="delimiter" select="$delimiter"/>
|
---|
918 | </gsl:call-template>
|
---|
919 | </gsl:when>
|
---|
920 | <gsl:otherwise>
|
---|
921 | <gsl:value-of select="$value"/>
|
---|
922 | </gsl:otherwise>
|
---|
923 | </gsl:choose>
|
---|
924 | </gsl:template>
|
---|
925 |
|
---|
926 |
|
---|
927 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
928 | - write actions
|
---|
929 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
---|
930 | <gsl:template name="writeout">
|
---|
931 | <gsl:param name="filename"/>
|
---|
932 | <gsl:param name="content"/>
|
---|
933 | <gsl:choose>
|
---|
934 | <gsl:when test="element-available('saxon:output')">
|
---|
935 | <saxon:output href="{$outdir}/{$filename}"
|
---|
936 | method="xml"
|
---|
937 | encoding="utf-8"
|
---|
938 | indent="yes">
|
---|
939 | <gsl:copy-of select="$content"/>
|
---|
940 | </saxon:output>
|
---|
941 | </gsl:when>
|
---|
942 | <gsl:when test="element-available('xalan:write')">
|
---|
943 | <xalan:write file="{$outdir}/{$filename}">
|
---|
944 | <gsl:copy-of select="$content"/>
|
---|
945 | </xalan:write>
|
---|
946 | </gsl:when>
|
---|
947 | <gsl:otherwise>
|
---|
948 | <gsl:message terminate="yes">
|
---|
949 | <gsl:text>Cannot write</gsl:text>
|
---|
950 | </gsl:message>
|
---|
951 | </gsl:otherwise>
|
---|
952 | </gsl:choose>
|
---|
953 | </gsl:template>
|
---|
954 |
|
---|
955 | </gsl:stylesheet>
|
---|