/[volute]/trunk/projects/grid/uws/doc/ivoadoc/ivoarestructure.xslt
ViewVC logotype

Contents of /trunk/projects/grid/uws/doc/ivoadoc/ivoarestructure.xslt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1433 - (show annotations)
Tue May 3 13:38:49 2011 UTC (9 years, 3 months ago) by harripa
File MIME type: text/plain
File size: 27723 byte(s)
pretty print the xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <x:stylesheet xmlns:x="http://www.w3.org/1999/XSL/Transform"
3 xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 version="2.0"
5 xmlns:h="http://www.w3.org/1999/xhtml"
6 xmlns="http://www.w3.org/1999/xhtml"
7 xmlns:vm="http://www.ivoa.net/xml/VOMetadata/v0.1"
8 xmlns:saxon="http://saxon.sf.net/"
9 exclude-result-prefixes="saxon"
10 >
11 <x:import href="vor2spec.xsl"/>
12 <x:output method="xml" indent="yes"
13 encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
14 exclude-result-prefixes="saxon"
15 />
16
17 <!--
18 This script is designed to help with the production of IVOA standards - it is derived from a script by Norman Gray, but is different in behaviour in that the document produced by the script is
19 intended to be used as input in the next round of editing.
20
21 Paul Harrison
22
23 The following supports a mildly-enhanced version of XHTML. Most
24 notably, it supports sectioning via nested <div class='section'>
25 elements, with the section title being given by the first
26 <h1><a name="secid"/><span class="secnum">1.1</span> Title</h1> child of the <div>. The <div> class can also
27 be 'section-nonum', with the obvious meaning, and the div can
28 have an 'id' attribute which allows cross-references to it.
29 Cross-references are supported by a <span class='xref'>id</span> element.
30
31 Appendices go in a <div class='appendices'>, and an abstract in
32 <div class='abstract'>
33
34 The <div>s can be collected into a ToC, at a location marked by
35 a <?toc?> PI.
36
37 Bibliography: entries can be marked with <span
38 class='cite'>ref</span>, and these can be collected into a .aux
39 file by running this stylesheet with the parameter 'target'
40 given as 'aux'. The location of the bibliography is marked by a
41 <?bibliography?> PI: this simply reads in a file
42 $document-id.bbl, the generation of which must be managed
43 externally to this script.
44
45
46 xml documents can be literally included (and formatted) with the <?xmlinc href=""?> processing instruction. The <?xmlinc ?> processing instruction should be enclosed within a <div> - All text within
47 the <div> will be replaced.
48
49 There's also a <span class='url'>url</span>, which formats the
50 URL appropriately, and a
51 <span class='rcsinfo'>$foo: bar $</span>, which extracts the
52 contents 'bar' from the string.
53
54 The output has extra properties added to support RDFa, using
55 information extracted from 'title' and 'abstract', and from
56 <meta name='DC.xxx'> and <meta name='rcsdate'> fields in the <head>
57 -->
58
59 <!-- We include support for RDFa in the following, via: the output doctype,
60 the 'profile' attribute in the head element, and the various 'property'
61 attributes in the text.
62 See <http://www.w3.org/TR/2008/WD-rdfa-syntax-20080221/#docconf>.
63 We also add a GRDDL transformation which independently specifies
64 the RDFa transformation. -->
65
66 <x:param name="target"/>
67
68 <x:param name="document-id">document-id</x:param>
69
70 <x:param name="reloadbib"/>
71
72
73
74 <!-- process root node -->
75 <x:template match="/">
76 <x:choose>
77 <x:when test="$target">
78 <x:message terminate="yes">Unrecognised target <x:value-of select="$target"/>
79 </x:message>
80 </x:when>
81 <x:otherwise>
82 <x:apply-templates select="child::node()"/>
83 </x:otherwise>
84 </x:choose>
85 </x:template>
86
87
88 <x:template match="h:head">
89 <head profile='http://www.w3.org/1999/xhtml/vocab'>
90 <x:apply-templates select="@*"/>
91 <x:apply-templates select="child::node()"/>
92 </head>
93 </x:template>
94
95
96 <x:template match="h:div[@class='section' or @class='section-nonum']">
97
98 <x:copy>
99 <x:apply-templates select="@*"/>
100 <x:variable name='id'>
101 <x:call-template name='make-section-id'/>
102 </x:variable>
103 <x:variable name="level">
104 <x:choose>
105 <x:when test="ancestor::h:div[@class='section']/ancestor::h:div[@class='section']">h4</x:when>
106 <x:when test="ancestor::h:div[@class='section']">h3</x:when>
107 <x:otherwise>h2</x:otherwise>
108 </x:choose>
109 </x:variable>
110 <x:message>section <x:value-of select="$level"/></x:message>
111 <x:element name='{$level}'>
112 <x:element name="a"><x:attribute name='name' select="$id"/>
113 <x:copy-of select="./(h:h2|h:h3|h:h4)/h:a/@*" />
114
115 </x:element>
116 <x:apply-templates select="." mode="make-section-name"/>
117 </x:element>
118 <x:apply-templates select="*[1]/following-sibling::node()"/><!-- perhaps a little dangerous perhaps better to have a template to ignore the first h1 etc after a section... -->
119 </x:copy>
120 </x:template>
121
122 <!-- this is not perfect either - depends how many levels down...
123 <x:template match="h:div[@class='section' or @class='section-nonum']/h1[1]|h2[1]|h3[1]">
124 </x:template>
125 -->
126
127 <!--
128 <x:template match="h:div[@class='section' or @class='section-nonum']">
129 <x:variable name="id">
130 <x:call-template name="make-section-id"/>
131 </x:variable>
132 <x:variable name="level">
133 <x:choose>
134 <x:when test="ancestor::h:div[@class='section']/ancestor::h:div[@class='section']">h4</x:when>
135 <x:when test="ancestor::h:div[@class='section']">h3</x:when>
136 <x:otherwise>h2</x:otherwise>
137 </x:choose>
138 </x:variable>
139 <x:element name="{$level}" namespace='http://www.w3.org/1999/xhtml'>
140 <x:if test="@id">
141 <x:attribute name='class'>hlink</x:attribute>
142 </x:if>
143 <x:apply-templates select="." mode="make-section-name"/>
144 <x:element name='a' namespace='http://www.w3.org/1999/xhtml'>
145 <x:attribute name='name'><x:value-of select='$id'/></x:attribute>
146 <x:if test="@id">
147 <x:attribute name='href'>#<x:value-of select='$id'/></x:attribute>
148 <x:text> [link here]</x:text>
149 </x:if>
150 </x:element>
151 </x:element>
152 <x:apply-templates/>
153 </x:template>
154 -->
155
156
157 <x:template match="h:div[@class='appendices']">
158 <x:copy>
159 <x:apply-templates select="@*"/>
160
161 <x:apply-templates select="child::node()"/>
162 </x:copy>
163 </x:template>
164
165 <x:template match="h:div" mode="make-toc">
166 <x:variable name="id">
167 <x:call-template name="make-section-id"/>
168 </x:variable>
169 <li>
170 <a href='#{$id}'>
171 <x:apply-templates select='.' mode='make-section-name'/>
172 </a>
173 <x:if test="h:div[@class='section' or @class='section-nonum']">
174 <ul>
175 <x:apply-templates select="h:div[@class='section' or @class='section-nonum']" mode="make-toc"/>
176 </ul>
177 </x:if>
178 </li>
179 </x:template>
180
181 <x:template match="h:div[processing-instruction()[1][count(preceding-sibling::element()) = 0]]">
182 <!-- the processing instructions will replace everything with the enclosing div if they are first - used for the toc, bibliography and xmlinc processing instucctions-->
183 <x:copy>
184 <x:comment>The contents of this div are automatially generated from the following processing instruction when processed with ivoarestructure.xsl</x:comment>
185 <x:text>
186 </x:text>
187 <x:choose>
188 <x:when test="child::processing-instruction('bibliography') and not($reloadbib)">
189 <x:apply-templates/>
190 </x:when>
191 <x:otherwise>
192 <x:apply-templates select="child::processing-instruction()"/>
193 </x:otherwise>
194 </x:choose>
195
196 </x:copy>
197 </x:template>
198
199 <x:template match="processing-instruction('toc')">
200 <x:processing-instruction name="toc"/>
201 <div id='toc' class='toc'>
202 <ul>
203 <x:apply-templates select="//h:div[@class='body']/h:div[@class='section' or @class='section-nonum']|//h:div[@class='body']/h:div[@class='appendices']/h:div" mode="make-toc"/>
204 </ul>
205 </div>
206
207 </x:template>
208
209 <x:template name="make-section-id">
210
211 <x:choose>
212 <x:when test="child::*[1]/h:a/@id">
213 <x:value-of select="child::*[1]/h:a/@id"/>
214 </x:when>
215 <x:otherwise>
216 <x:value-of select="generate-id()"/>
217 </x:otherwise>
218 </x:choose>
219 </x:template>
220
221 <x:template match="h:div" mode="make-section-name">
222 <x:element name="span"><x:attribute name="class" select="'secnum'"></x:attribute>
223 <x:apply-templates select="." mode="make-section-number"/>
224 </x:element>
225 <x:apply-templates select="child::*[1]/text()"/>
226 </x:template>
227
228 <x:template match="h:div" mode="make-section-number"><!-- would named template be better? -->
229 <x:choose>
230 <x:when test="ancestor-or-self::h:div[@class='section-nonum']"/>
231 <x:when test="ancestor::h:div[@class='appendices']">
232 <x:text>Appendix </x:text>
233 <x:number count="h:div[@class='section']" level="multiple" format="A.1."/>
234 <x:text> </x:text>
235 </x:when>
236 <x:otherwise>
237 <x:number count="h:div[@class='section']" level="multiple" format="1.1."/>
238 <x:text> </x:text>
239 </x:otherwise>
240 </x:choose>
241
242
243 </x:template>
244
245 <x:template match="processing-instruction('bibliography')">
246 <x:copy/>
247 <x:choose><x:when test="contains(.,'replace')">
248
249 <!-- think of better way to get the document id in -->
250 <x:if test="$document-id ne 'document-id'">
251 <x:copy-of select="document(concat(substring-before($document-id, '.xml'),'.bbl'))"/>
252 </x:if>
253 </x:when></x:choose>
254 </x:template>
255
256 <x:template match="h:cite">
257 <!-- need to do this as numbered along with bibstyle... -->
258 <x:copy>
259 <x:variable name="ref">
260 <x:choose>
261 <x:when test="h:a/@href">
262 <x:value-of select="substring-after(h:a/@href,'#')"/>
263 </x:when>
264 <x:otherwise>
265 <x:value-of select="."/>
266 </x:otherwise>
267 </x:choose>
268 </x:variable>
269 [<a href='#{$ref}'><x:value-of select='$ref'/></a>]
270 </x:copy>
271 </x:template>
272
273 <x:template match="h:span[@class='url']">
274 <a href='{text()}'>
275 <span class='url'><x:value-of select='.'/></span>
276 </a>
277 </x:template>
278
279
280 <x:key name="xrefs" match="h:div[(h:h1|h:h2|h:h3|h:h4|h:h5|h:h6)/h:a]" use="*/h:a/@id"/><!-- can only reference sections at the moment -->
281
282 <x:template match="h:span[@class='xref']">
283 <span class="xref">
284
285 <x:variable name="id">
286 <x:choose>
287 <x:when test="h:a/@href">
288 <x:value-of select="substring-after(h:a/@href, '#')"/>
289 </x:when>
290 <x:otherwise>
291 <x:value-of select="."/> <!-- can just put in the xref span -->
292 </x:otherwise>
293 </x:choose>
294 </x:variable>
295 <x:choose>
296 <x:when test="key('xrefs',$id)">
297 <x:message>putting in xref <x:value-of select="$id"/></x:message>
298 </x:when>
299 <x:otherwise>
300 <x:message >error putting in xref <x:value-of select="$id"/> - destination does not exist </x:message>
301 </x:otherwise>
302 </x:choose>
303 <a href='#{$id}'>
304 <x:apply-templates select="key('xrefs',$id)" mode="make-section-number"/>
305 </a>
306 </span>
307 </x:template>
308
309 <x:template match="h:span[@class='rcsinfo']">
310 <x:value-of select="substring-before(substring-after(.,': '),' $')"/>
311 </x:template>
312
313
314 <!-- maybe later
315 <x:template xmlns:owl="http://www.w3.org/2002/07/owl#" match="h:meta">
316 <x:choose>
317 <x:when test="@name='DC.rights'">
318 <link about='' rel='{@name}' href='{@content}'/>
319 </x:when>
320 <x:when test="@name='rcsdate'">
321 <meta about='' property='dcterms:modified'>
322 <x:attribute name='content'>
323 <x:value-of select="translate(substring(@content,8,10),'/','-')"/>
324 <x:text>T</x:text>
325 <x:value-of select="substring(@content,19,8)"/>
326 </x:attribute>
327 </meta>
328 </x:when>
329 <x:when test="@name='purl'">
330 <link about='' rel='dc:identifier' href='{@content}'/>
331 <link about='' rel='owl:sameAs' href='{@content}'/>
332 </x:when>
333 <x:when test="starts-with(@name,'DC.')">
334 <meta about='' content='{@content}'>
335 <x:attribute name="property">dc:<x:value-of select="substring-after(@name, 'DC.')"/>
336 </x:attribute>
337 </meta>
338 </x:when>
339 <x:when test='@property and @content'>
340
341 <x:copy-of select='.'/>
342 </x:when>
343 </x:choose>
344 </x:template>
345 -->
346
347 <x:template match="h:div[@class='signature']">
348 <x:copy>
349 <x:apply-templates select="@*"/>
350 <x:choose>
351 <x:when test="h:a/@href">
352 <x:attribute name="href">
353 <x:value-of select="h:a/@href"/>
354 </x:attribute>
355 </x:when>
356 <x:otherwise>
357 <x:attribute name="content">
358 <x:value-of select="h:a/text()"/>
359 </x:attribute>
360 </x:otherwise>
361 </x:choose>
362 <x:apply-templates/>
363 </x:copy>
364 </x:template>
365
366 <x:template match="h:div[@class='abstract']">
367 <x:copy>
368 <x:apply-templates select="@*"/>
369 <x:element name='meta' namespace='http://www.w3.org/1999/xhtml'>
370 <x:attribute name='about'/>
371 <x:attribute name="content">
372 <x:apply-templates select="h:p[not(@class)]" mode="text-only"/>
373 </x:attribute>
374 </x:element>
375 <x:apply-templates select="child::node()"/>
376 </x:copy>
377 </x:template>
378
379 <!-- <x:template match="h:q">
380 <x:text>“</x:text>
381 <x:apply-templates/>
382 <x:text>”</x:text>
383 </x:template> -->
384
385 <x:template match="h:p" mode="text-only">
386 <x:value-of select="normalize-space(.)"/>
387 <x:text> </x:text>
388 </x:template>
389
390 <x:template match="processing-instruction('incxml')">
391 <x:copy/>
392 <x:analyze-string regex="href=['&quot;]([^'&quot;]+)['&quot;] +select=['&quot;]([^'&quot;]+)['&quot;]" select=".">
393 <x:matching-substring>
394 <!-- crude ability to select an element & children - neets to be smartened up to more xpath like, but namespaces a problem -->
395 <x:message>Including only <x:value-of select="regex-group(2)"/> element xml from <x:value-of select="regex-group(1)"/> </x:message>
396 <x:apply-templates select="document(regex-group(1))//saxon:evaluate(regex-group(2))" mode="printxml"></x:apply-templates>
397
398 </x:matching-substring>
399 <x:non-matching-substring>
400 <x:analyze-string regex="href=['&quot;]([^'&quot;]+)['&quot;]" select=".">
401 <x:matching-substring>
402 <x:message>Including xml from <x:value-of select="regex-group(1)"/></x:message>
403 <x:apply-templates select="document(regex-group(1))" mode="printxml"></x:apply-templates>
404 </x:matching-substring>
405 </x:analyze-string>
406 </x:non-matching-substring>
407 </x:analyze-string>
408
409 </x:template>
410 <x:template match="processing-instruction('schemadef')">
411 <x:copy/>
412 <x:message>schemadef <x:value-of select="."/></x:message>
413 <x:choose>
414 <x:when test="starts-with(., 'href')">
415 <x:analyze-string regex="href=['&quot;]([^'&quot;]+)['&quot;] +defn=['&quot;]([^'&quot;]+)['&quot;]" select=".">
416 <x:matching-substring>
417 <x:message>Including schema from <x:value-of select="regex-group(1)"/> element <x:value-of select="regex-group(2)"/></x:message>
418 <x:apply-templates select="document(regex-group(1))/saxon:evaluate('/xs:schema/(xs:complexType|xs:simpleType)[@name=$p1]',regex-group(2))" mode="def">
419 <x:with-param name="thisprefix" select="document(regex-group(1))/xs:schema/xs:annotation/xs:appinfo/vm:targetPrefix" ></x:with-param>
420 </x:apply-templates>
421 </x:matching-substring>
422 <x:non-matching-substring>
423 <x:message>did not match <x:value-of select="."/></x:message>
424 </x:non-matching-substring>
425 </x:analyze-string>
426 </x:when>
427
428 </x:choose>
429 </x:template>
430
431 <!-- default identity transformation -->
432 <x:template match="node()|@*">
433 <x:copy>
434 <x:apply-templates select="node()|@*"/>
435 </x:copy>
436 </x:template>
437
438 <!-- printxml stuff -->
439
440 <x:template match="/" mode="printxml" >
441 <div class="viewxml">
442 <x:apply-templates select="child::node()" mode="printxml"/>
443 </div>
444 </x:template>
445
446 <x:template match="/*" mode="printxml" priority="1"><!-- try to add the namespaces for the root element -->
447 <x:message>in root element <x:value-of select="name(.)"/></x:message>
448 <div class="element">
449 <span class="markup">&lt;</span><span class="start-tag"><x:value-of select="name(.)"/></span><x:apply-templates select="@*" mode="printxml"/>
450 <x:variable name="v" select="."/>
451 <x:for-each select="in-scope-prefixes(.)">
452 <x:text> </x:text><span class="attribute-name"><x:text>xmlns:</x:text><x:value-of select="."/></span><span class="markup">=</span><span class="attribute-value">"<x:value-of select="namespace-uri-for-prefix(., $v)"/>"</span>
453 </x:for-each>
454 <span class="markup">&gt;</span>
455 <x:apply-templates select="child::node()" mode="printxml"/>
456 <span class="markup">&lt;/</span><span class="end-tag"><x:value-of select="name(.)"/></span><span class="markup">&gt;</span>
457 </div>
458 </x:template>
459
460
461 <x:template match="processing-instruction()" mode="printxml">
462 <div class="indent pi">
463 <x:text>&lt;?</x:text>
464 <x:value-of select="name(.)"/>
465 <x:text> </x:text>
466 <x:value-of select="."/>
467 <x:text>?&gt;</x:text>
468 </div>
469 </x:template>
470
471 <x:template match="comment()" mode="printxml">
472 <x:message>comment</x:message>
473 <div class="comment"><x:text>&lt;!--</x:text><x:value-of select="."/><x:text>--&gt;</x:text></div>
474 </x:template>
475
476
477 <x:template match="*" mode="printxml" >
478 <x:message>all <x:value-of select="name(.)"/></x:message>
479 <div class="indent">
480 <span class="markup">&lt;</span>
481 <span class="start-tag"><x:value-of select="name(.)"/></span>
482 <x:apply-templates select="@*" mode="printxml"/>
483 <span class="markup">/&gt;</span>
484 </div>
485 </x:template>
486
487 <!-- this template causes ambiguity with the next one - seems harmless in saxon, but need to understand how to remove - cause of ambiguity is that there can be more than one child -->
488 <x:template match="*[text()]" mode="printxml">
489 <div class="indent">
490 <span class="markup">&lt;</span>
491 <span class="start-tag"><x:value-of select="name(.)"/></span>
492 <x:apply-templates select="@*" mode="printxml"/>
493 <span class="markup">&gt;</span>
494 <span class="text"><x:value-of select="."/></span>
495 <span class="markup">&lt;/</span>
496 <span class="end-tag"><x:value-of select="name(.)"/></span>
497 <span class="markup">&gt;</span>
498 </div>
499 </x:template>
500
501
502 <x:template match="*[element()]" mode="printxml" >
503 <div class="element">
504 <span class="markup">&lt;</span><span class="start-tag"><x:value-of select="name(.)"/></span><x:apply-templates select="@*" mode="printxml"/><span class="markup">&gt;</span>
505 <x:apply-templates select="child::node()" mode="printxml"/>
506 <span class="markup">&lt;/</span><span class="end-tag"><x:value-of select="name(.)"/></span><span class="markup">&gt;</span>
507 </div>
508 </x:template>
509
510
511
512 <x:template match="@*" mode="printxml">
513 <x:text> </x:text><span class="attribute-name"><x:value-of select="name(.)"/></span><span class="markup">=</span><span class="attribute-value">"<x:value-of select="."/>"</span>
514 </x:template>
515
516
517 <x:template match="text()" mode="printxml">
518 <x:if test="normalize-space(.)">
519 <div class="indent text"><x:value-of select="."/></div>
520 </x:if>
521 </x:template>
522
523 <!-- from Ray's schema formatting via Markus -->
524
525 <x:template match="xs:complexType|xs:simpleType" mode="xsddef" xml:space="preserve">
526 <div class="schemaOuter">
527 <a name="s:{@name}">
528 </a><div class="schemaHeader"><x:apply-templates select="." mode="schemaDefTitle"/></div>
529 <div class="schemaInner">
530 <pre><x:apply-templates select="." mode="xsdcode"/></pre>
531 </div></div>
532 </x:template>
533
534 <x:template match="xs:complexType[xs:simpleContent]" mode="content"/>
535
536 <x:template match="xs:complexType" mode="content" xml:space="preserve">
537 <p>
538 <table border="2" width="100%" id="d:{@name}">
539 <thead>
540 <tr><th colspan="2" align="left"><x:apply-templates select="." mode="MetadataTitle"/></th>
541 </tr><tr><th>Element</th><th>Definition</th>
542 </tr></thead>
543 <tbody>
544 <x:apply-templates select=".//xs:element" mode="content"/>
545 </tbody>
546 </table>
547 </p>
548 </x:template>
549
550 <x:template match="xs:simpleType" mode="content"/>
551
552 <x:template match="xs:complexType|xs:simpleType" mode="attributes">
553 <x:if test=".//xs:attribute" xml:space="preserve">
554 <p>
555 <table border="2" width="100%">
556 <thead>
557 <tr><th colspan="2" align="left"><x:apply-templates select="." mode="attributeTitle"/></th>
558 </tr><tr><th>Attribute</th><th>Definition</th>
559 </tr></thead>
560 <tbody>
561 <x:apply-templates select=".//xs:attribute" mode="attributes"/>
562 </tbody>
563 </table>
564 </p>
565 </x:if>
566 </x:template>
567
568 <x:template match="xs:element" mode="content" xml:space="preserve">
569 <tr><td valign="top"><x:value-of select="@name"/></td>
570 <td valign="top"><table border="0" width="100%"><tbody>
571 <x:apply-templates select="." mode="nextContentItem"/> </tbody></table>
572 </td></tr>
573 </x:template>
574
575 <x:template match="xs:attribute" mode="attributes" xml:space="preserve">
576 <tr><td valign="top"><x:value-of select="@name"/></td>
577 <td valign="top"><table border="0" width="100%"><tbody>
578 <x:apply-templates select="." mode="nextContentItem"/> </tbody></table>
579 </td></tr>
580 </x:template>
581
582 <x:template match="xs:element" mode="content.rmname">
583 <x:param name="row" select="1"/>
584
585 <x:for-each select="." xml:space="preserve"> <tr bgcolor="#dddddd"><td nowrap="nowrap" valign="top"><em>RM Name:</em></td>
586 <td valign="top"><x:for-each select="xs:annotation/xs:appinfo/vm:dcterm" xml:space="default">
587 <x:if test="position()!=1">
588 <x:text>, </x:text>
589 </x:if>
590 <x:value-of select="."/>
591 </x:for-each></td>
592 </tr>
593 </x:for-each>
594 </x:template>
595
596 <x:template match="xs:element|xs:attribute" mode="content.type">
597 <x:param name="row" select="1"/>
598
599 <x:variable name="type">
600 <x:choose>
601 <x:when test="@type">
602 <x:apply-templates select="@type" mode="type"/>
603 </x:when>
604 <x:otherwise>
605 <x:apply-templates select="xs:complexType|xs:simpleType"
606 mode="type"/>
607 </x:otherwise>
608 </x:choose>
609 </x:variable>
610
611 <x:variable name="color">
612 <x:call-template name="rowBgColor">
613 <x:with-param name="row" select="$row"/>
614 </x:call-template>
615 </x:variable>
616
617 <x:for-each select="." xml:space="preserve"> <tr bgcolor="{$color}"><td nowrap="nowrap" valign="top"><em>Value type:</em></td>
618 <td valign="top"><x:copy-of select="$type"/></td>
619 </tr>
620 </x:for-each>
621 </x:template>
622
623 <x:template match="xs:element|xs:attribute" mode="content.meaning">
624 <x:param name="row" select="1"/>
625
626 <x:variable name="color">
627 <x:call-template name="rowBgColor">
628 <x:with-param name="row" select="$row"/>
629 </x:call-template>
630 </x:variable>
631
632 <x:for-each select="." xml:space="preserve"> <tr bgcolor="{$color}"><td nowrap="nowrap" valign="top"><em>Semantic Meaning:</em></td>
633 <td valign="top" width="90%"><x:copy-of select="xs:annotation/xs:documentation[1]/node()"/></td>
634 </tr>
635 </x:for-each>
636 </x:template>
637
638 <x:template match="xs:attribute" mode="content.default">
639 <x:param name="row" select="1"/>
640
641 <x:variable name="color">
642 <x:call-template name="rowBgColor">
643 <x:with-param name="row" select="$row"/>
644 </x:call-template>
645 </x:variable>
646
647 <x:for-each select="." xml:space="preserve"> <tr bgcolor="{$color}"><td nowrap="nowrap"
648 valign="top"><em>Default Value:</em></td>
649 <td valign="top" width="90%"><code><x:value-of select="@default"/></code></td>
650 </tr>
651 </x:for-each>
652 </x:template>
653
654 <x:template match="xs:element|xs:attribute" mode="content.occurrences">
655 <x:param name="row" select="1"/>
656
657 <x:variable name="color">
658 <x:call-template name="rowBgColor">
659 <x:with-param name="row" select="$row"/>
660 </x:call-template>
661 </x:variable>
662
663 <x:for-each select="." xml:space="preserve"> <tr bgcolor="{$color}"><td nowrap="nowrap" valign="top"><em>Occurrences:</em></td>
664 <td valign="top"><x:apply-templates select="." mode="occurrences"/></td>
665 </tr>
666 </x:for-each>
667 </x:template>
668
669 <x:template match="xs:element|xs:attribute" mode="content.allowedValues">
670 <x:param name="row" select="1"/>
671 <x:param name="type" select="@type"/>
672
673 <x:variable name="color">
674 <x:call-template name="rowBgColor">
675 <x:with-param name="row" select="$row"/>
676 </x:call-template>
677 </x:variable>
678
679 <x:for-each select="." xml:space="preserve"> <tr bgcolor="{$color}"><td nowrap="nowrap" valign="top"><em>Allowed Values:</em></td>
680 <td valign="top"><x:apply-templates select="xs:simpleType/xs:restriction|/xs:schema/xs:simpleType[@name=substring-after($type,':')]/xs:restriction" mode="howtolist" /></td>
681 </tr>
682 </x:for-each>
683 </x:template>
684
685 <x:template match="xs:restriction[xs:enumeration]" mode="howtolist">
686 <x:choose>
687 <x:when test="xs:enumeration/xs:annotation/xs:documentation"
688 xml:space="preserve"><table border="0" width="100%"><tbody>
689 <x:apply-templates select="xs:enumeration" mode="controlledVocab" />
690 </tbody></table></x:when>
691 <x:otherwise>
692 <x:for-each select="xs:enumeration">
693 <code><x:value-of select="@value"/></code>
694 <x:if test="position()!=last()">
695 <x:text>, </x:text>
696 </x:if>
697 </x:for-each>
698 </x:otherwise>
699 </x:choose>
700 </x:template>
701
702 <x:template match="xs:enumeration" mode="controlledVocab" xml:space="preserve">
703 <tr><td valign="top"><code><x:value-of select="@value"/></code> </td>
704 <td><x:value-of select="xs:annotation/xs:documentation"/></td></tr>
705 </x:template>
706
707 <x:template match="xs:element|xs:attribute" mode="content.comment">
708 <x:param name="row" select="1"/>
709
710 <x:variable name="color">
711 <x:call-template name="rowBgColor">
712 <x:with-param name="row" select="$row"/>
713 </x:call-template>
714 </x:variable>
715
716 <x:for-each select="." xml:space="preserve"> <tr bgcolor="{$color}"><td nowrap="nowrap" valign="top"><em>Comments:</em></td>
717 <td valign="top"><x:for-each select="xs:annotation/xs:documentation[position() > 1]">
718 <p><x:copy-of select="./node()"/></p>
719 </x:for-each></td>
720 </tr>
721 </x:for-each>
722 </x:template>
723
724
725
726 <x:template name="rowBgColor">
727 <x:param name="row" select="1"/>
728 <x:choose>
729 <x:when test="$row mod 2 = 1">#dddddd</x:when>
730 <x:otherwise>#f5f5f5</x:otherwise>
731 </x:choose>
732 </x:template>
733
734 </x:stylesheet>

Properties

Name Value
svn:mergeinfo
svn:mime-type text/plain

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26