forked from bitfehler/xs3p
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xs3p.xsl
8354 lines (7861 loc) · 357 KB
/
xs3p.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
Copyright (C) DSTC Pty Ltd (ACN 052 372 577) 2002
The software contained on this media is the property of the
DSTC Pty Ltd. Use of this software is strictly in accordance
with the license agreement in the accompanying LICENSE file.
If your distribution of this software does not contain a
LICENSE file then you have no rights to use this software
in any manner and should contact DSTC at the address below
to determine an appropriate licensing arrangement.
DSTC Pty Ltd
Level 7, General Purpose South
The University of Queensland
QLD 4072 Australia
Tel: +61 7 3365 4310
Fax: +61 7 3365 4311
Email: [email protected]
This software is being provided "AS IS" without warranty of
any kind. In no event shall DSTC Pty Ltd be liable for
damage of any kind arising out of or in connection with
the use or performance of this software.
-->
<!--
File:
xs3p.xsl
Description:
Stylesheet that generates XHTML documentation, given an XML
Schema document
Assumptions:
-Resulting documentation will only be displayed properly with
the latest browsers that support XHTML and CSS. Older
browsers are not supported.
-Assumed that XSD document conforms to the XSD recommendation.
No validity checking is done.
Constraints:
-Local schema components cannot contain two dashes in
'documentation' elements within their 'annotation' element.
This is because the contents of those 'documentation'
elements are displayed in a separate window using Javascript.
This Javascript code is enclosed in comments, which do not
allow two dashes inside themselves.
Notes:
-Javascript code is placed within comments, even though in
strict XHTML, JavaScript code should be placed within CDATA
sections. This is because current browsers generate a syntax
error if the page contains CDATA sections. Placing Javascript
code within comments means that the code cannot contain two
dashes.
(See 'PrintJSCode' named template.)
Stylesheet Sections:
-Global Parameters
Specify parameters that can be set externally to customise
stylesheet
-Constants
Constants used by the stylesheet
-Main Document
Templates to generate the overall document and the top-level
sections within it
-Hierarchy table
Templates for displaying type hierarchy for simple and
complex types, and substitution group hierarchy for elements
-Properties table
Templates for displaying the properties of top-level schema
components
-XML Instance Representation table
Templates for displaying how an XML instance conforming to
the schema component would look like
-Schema Component Representation table
Templates for displaying the XML representation of the schema
component
-XML Pretty Printer
Templates for displaying arbitrary XML instances
-Handling Schema Component References
Templates for generating internal and external links
-General Utility Templates
General templates used by other templates in this stylesheet
To Do List:
-It is not clever when printing out element and attribute
wildcards in the XML Instance Representation tables. It prints
out all wildcards, rather than working out the actual wildcard
is from multiple wildcard instances.
-Same as above for simple type constraints, e.g. it doesn't
summarise multiple pattern constraints.
-->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ppp="http://titanium.dstc.edu.au/xml/xs3p"
version="1.0"
exclude-result-prefixes="xsd ppp html">
<xsl:output
method="xml"
omit-xml-declaration="yes"
doctype-system="about:legacy-compat"
indent="yes"/>
<xsl:key name="type" match="/xsd:schema/xsd:complexType | /xsd:schema/xsd:simpleType | /xsd:schema/xsd:redefine/xsd:complexType | /xsd:schema/xsd:redefine/xsd:simpleType" use="@name" />
<xsl:key name="complexType" match="/xsd:schema/xsd:complexType | /xsd:schema/xsd:redefine/xsd:complexType" use="@name" />
<xsl:key name="simpleType" match="/xsd:schema/xsd:simpleType | /xsd:schema/xsd:redefine/xsd:simpleType" use="@name" />
<xsl:key name="attributeGroup" match="/xsd:schema/xsd:attributeGroup | /xsd:schema/xsd:redefine/xsd:attributeGroup" use="@name" />
<xsl:key name="group" match="/xsd:schema/xsd:group | /xsd:schema/xsd:redefine/xsd:group" use="@name" />
<xsl:key name="attribute" match="/xsd:schema/xsd:attribute" use="@name" />
<xsl:key name="element" match="/xsd:schema/xsd:element" use="@name" />
<!-- ******** Global Parameters ******** -->
<!-- Title of HTML document. -->
<xsl:param name="title"></xsl:param>
<!-- If 'true', sorts the top-level schema components by type,
then name. Otherwise, displays the components by the order that
they appear in the schema. -->
<xsl:param name="sortByComponent">true</xsl:param>
<!-- If 'true', prints all super-types in the
type hierarchy box.
Otherwise, prints the parent type only in the
type hierarchy box. -->
<xsl:param name="printAllSuperTypes">true</xsl:param>
<!-- If 'true', prints all sub-types in the
type hierarchy box.
Otherwise, prints the direct sub-types only in the
type hierarchy box. -->
<xsl:param name="printAllSubTypes">true</xsl:param>
<!-- If 'true', prints out the Glossary section. -->
<xsl:param name="printGlossary">true</xsl:param>
<!-- If 'true', prints prefix matching namespace of schema
components in XML Instance Representation tables. -->
<xsl:param name="printNSPrefixes">true</xsl:param>
<!-- If 'true', searches 'included' schemas for schema components
when generating links and XML Instance Representation tables. -->
<xsl:param name="searchIncludedSchemas">false</xsl:param>
<!-- If 'true', searches 'imported' schemas for schema components
when generating links and XML Instance Representation tables. -->
<xsl:param name="searchImportedSchemas">false</xsl:param>
<!-- File containing the mapping from file locations of external
(e.g. included, imported, refined) schemas to file locations
of their XHTML documentation. -->
<xsl:param name="linksFile"></xsl:param>
<!-- Set the base URL for resolving links. -->
<xsl:param name="baseURL"></xsl:param>
<!-- Uses an external CSS stylesheet rather than using
internally-declared CSS properties. This refers to xs3p
specific CSS, not the Bootstrap CSS. -->
<xsl:param name="externalCSSURL"></xsl:param>
<!-- Link to JQuery. -->
<xsl:param name="jQueryURL">https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js</xsl:param>
<!-- Link base to Bootstrap CSS and JS. The files
<bootstrapURL>/css/bootstrap.min.css and
<bootstrapURL>/js/bootstrap.min.js must exist.-->
<xsl:param name="bootstrapURL">https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6</xsl:param>
<!-- ******** Constants ******** -->
<!-- XML Schema Namespace -->
<xsl:variable name="XSD_NS">http://www.w3.org/2001/XMLSchema</xsl:variable>
<!-- XML Namespace -->
<xsl:variable name="XML_NS">http://www.w3.org/XML/1998/namespace</xsl:variable>
<!-- Number of spaces to indent from parent element's start tag to
child element's start tag -->
<xsl:variable name="ELEM_INDENT">3</xsl:variable>
<!-- Number of spaces to indent from parent element's start tag to
attribute's tag -->
<xsl:variable name="ATTR_INDENT">1</xsl:variable>
<!-- Title to use if none provided -->
<xsl:variable name="DEFAULT_TITLE">XML Schema Documentation</xsl:variable>
<!-- Prefixes used for anchor names -->
<!-- Type definitions -->
<xsl:variable name="TYPE_PREFIX">type_</xsl:variable>
<!-- Attribute declarations -->
<xsl:variable name="ATTR_PREFIX">attribute_</xsl:variable>
<!-- Attribute group definitions -->
<xsl:variable name="ATTR_GRP_PREFIX">attributeGroup_</xsl:variable>
<!-- Complex type definitions -->
<xsl:variable name="CTYPE_PREFIX" select="$TYPE_PREFIX"/>
<!-- Element declarations -->
<xsl:variable name="ELEM_PREFIX">element_</xsl:variable>
<!-- Key definitions -->
<xsl:variable name="KEY_PREFIX">key_</xsl:variable>
<!-- Group definitions -->
<xsl:variable name="GRP_PREFIX">group_</xsl:variable>
<!-- Notations -->
<xsl:variable name="NOTA_PREFIX">notation_</xsl:variable>
<!-- Namespace declarations -->
<xsl:variable name="NS_PREFIX">ns_</xsl:variable>
<!-- Simple type definitions -->
<xsl:variable name="STYPE_PREFIX" select="$TYPE_PREFIX"/>
<!-- Glossary terms -->
<xsl:variable name="TERM_PREFIX">term_</xsl:variable>
<!-- The original schema needs to be stored because when
calculating links for references, the links have to be
relative to the original schema. See 'PrintCompRef'
template. -->
<xsl:variable name="ORIGINAL_SCHEMA" select="/xsd:schema"/>
<!-- Help texts used throughout the document. -->
<!-- Hierarchy table -->
<xsl:variable name="HELP_HIERARCHY">This table shows the schema components type hierarchy.</xsl:variable>
<!-- Properties table -->
<xsl:variable name="HELP_PROPERTIES">This table displays the properties of the schema component.</xsl:variable>
<!-- Documentation panel -->
<xsl:variable name="HELP_DOCUMENTATION">This panel contains the schema components documentation.</xsl:variable>
<!-- Instance table -->
<xsl:variable name="HELP_INSTANCE">
<xsl:text>The XML Instance Representation table shows the schema component's content as an XML instance.
<ul>
<li>The minimum and maximum occurrence of elements and attributes are provided in square brackets, e.g. [0..1].</li>
<li>Model group information are shown in gray, e.g. Start Choice ... End Choice.</li>
<li>For type derivations, the elements and attributes that have been added to or changed from the base type's content are shown in <strong>bold</strong></li>
<li>If an element/attribute has a fixed value, the fixed value is shown in green.</li>
<li>More stuff</li>
<li>If a local element/attribute has documentation, it will be displayed in a window that pops up when the question mark inside the attribute or next to the element is clicked.</li>
</ul>
</xsl:text>
</xsl:variable>
<!-- Representation table -->
<xsl:variable name="HELP_REPRESENTATION">The Schema Component Representation table above displays the underlying XML representation of the schema component. (Annotations are not shown.)</xsl:variable>
<!-- ******** Main Document ******** -->
<!--
Main template that starts the process
-->
<xsl:template match="/xsd:schema">
<!-- Check that links file is provided if searching external
schemas for components. -->
<xsl:if test="$linksFile='' and (normalize-space(translate($searchIncludedSchemas, 'TRUE', 'true'))='true' or normalize-space(translate($searchImportedSchemas, 'TRUE', 'true'))='true')">
<xsl:call-template name="HandleError">
<xsl:with-param name="isTerminating">true</xsl:with-param>
<xsl:with-param name="errorMsg">
'linksFile' variable must be provided if either
'searchIncludedSchemas' or 'searchImportedSchemas' is true.
</xsl:with-param>
</xsl:call-template>
</xsl:if>
<!-- Get title of document -->
<xsl:variable name="actualTitle">
<xsl:choose>
<xsl:when test="$title != ''">
<xsl:value-of select="$title"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$DEFAULT_TITLE"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<html>
<head>
<!-- Set title bar -->
<title><xsl:value-of select="$actualTitle"/></title>
<!-- Set content type -->
<meta charset="UTF-8"/>
<!-- Set base URL to use in working out relative paths -->
<xsl:if test="$baseURL != ''">
<xsl:element name="base">
<xsl:attribute name="href"><xsl:value-of select="$baseURL"/></xsl:attribute>
</xsl:element>
</xsl:if>
<!-- CSS included here, JS at end of body. -->
<link href="{$bootstrapURL}/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Set CSS styles -->
<style type="text/css">
<xsl:choose>
<!-- Use external CSS stylesheet -->
<xsl:when test="$externalCSSURL != ''">
<xsl:text>
@import url(</xsl:text><xsl:value-of select="$externalCSSURL"/><xsl:text>);
</xsl:text>
</xsl:when>
<!-- Use internal CSS styles -->
<xsl:otherwise>
<xsl:call-template name="DocumentCSSStyles"/>
</xsl:otherwise>
</xsl:choose>
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pagedown/1.0/Markdown.Converter.js">
// Import Markdown converter for comments processing
</script>
</head>
<body data-spy="scroll" data-target=".xs3p-sidebar" data-offset="65">
<div class="navbar navbar-fixed-top navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"><xsl:text> </xsl:text></span>
<span class="icon-bar"><xsl:text> </xsl:text></span>
<span class="icon-bar"><xsl:text> </xsl:text></span>
</button>
<a class="navbar-brand xs3p-navbar-title"><xsl:value-of select="$actualTitle"/></a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-md-3" id="menu-cols">
<div class="xs3p-sidebar hidden-print" role="complementary">
<xsl:apply-templates select="." mode="toc"/>
</div>
</div>
<div class="col-md-9 content" role="main" id="xs3p-content">
<!-- Note: some indentation resets in order to keep a minimum diff readability. -->
<!-- Hidden documentation snippets for display in the popup -->
<xsl:apply-templates select="." mode="hiddendoc"/>
<!-- Title -->
<h1><a id="top"><xsl:value-of select="$actualTitle"/></a></h1>
<!-- Section: Schema Document Properties -->
<section id="SectionSchemaProperties">
<h2><a id="SchemaProperties">Schema Document Properties</a></h2>
<!-- Sub-section: Properties table -->
<xsl:apply-templates select="." mode="properties"/>
<!-- Sub-section: Namespace Legend -->
<!--<h3>Declared Namespaces</h3>-->
<xsl:apply-templates select="." mode="namespaces"/>
<!-- Sub-section: Schema Component Representation table -->
<xsl:call-template name="SchemaComponentTable">
<xsl:with-param name="component" select="."/>
</xsl:call-template>
<xsl:call-template name="SectionFooter"/>
</section>
<!-- Section: Redefined Schema Components -->
<xsl:if test="xsd:redefine">
<h2><a id="Redefinitions">Redefined Schema Components</a></h2>
<xsl:apply-templates select="xsd:redefine/xsd:simpleType | xsd:redefine/xsd:complexType | xsd:redefine/xsd:attributeGroup | xsd:redefine/xsd:group" mode="topSection"/>
</xsl:if>
<!-- Sections: Top-level Schema Components -->
<xsl:choose>
<!-- Sort schema components -->
<xsl:when test="normalize-space(translate($sortByComponent,'TRUE','true'))='true'">
<!-- Declarations -->
<xsl:if test="xsd:attribute or xsd:element">
<section id="SectionSchemaDeclarations">
<h2><a id="SchemaDeclarations">Global Declarations</a></h2>
<xsl:apply-templates select="xsd:attribute | xsd:element" mode="topSection">
<xsl:sort select="local-name(.)" order="ascending"/>
<xsl:sort select="@name" order="ascending"/>
</xsl:apply-templates>
</section>
</xsl:if>
<!-- Definitions -->
<xsl:if test="xsd:attributeGroup or xsd:complexType or xsd:group or xsd:notation or xsd:simpleType">
<section id="SectionSchemaDefinitions">
<h2><a id="SchemaDefinitions">Global Definitions</a></h2>
<xsl:apply-templates select="xsd:attributeGroup | xsd:complexType | xsd:group | xsd:notation | xsd:simpleType" mode="topSection">
<xsl:sort select="local-name(.)" order="ascending"/>
<xsl:sort select="@name" order="ascending"/>
</xsl:apply-templates>
</section>
</xsl:if>
</xsl:when>
<!-- Display schema components as they occur -->
<xsl:otherwise>
<h2><a id="SchemaComponents">Global Schema Components</a></h2>
<xsl:apply-templates select="xsd:attribute | xsd:attributeGroup | xsd:complexType | xsd:element | xsd:group | xsd:notation | xsd:simpleType" mode="topSection"/>
</xsl:otherwise>
</xsl:choose>
<!-- Section: Glossary -->
<xsl:if test="normalize-space(translate($printGlossary,'TRUE','true'))='true'">
<div id="glossary">
<h2><a id="Glossary">Glossary</a></h2>
<xsl:call-template name="Glossary"/>
<xsl:call-template name="SectionFooter"/>
</div>
</xsl:if>
<!-- Document Footer -->
<p class="footer">
<xsl:text>Generated by </xsl:text>
<a href="http://github.com/bitfehler/xs3p">xs3p-ch</a> (fork of <a href="http://xml.fiforms.org/xs3p/">xs3p</a>)
<xsl:text>. Last Modified: </xsl:text>
<xsl:call-template name="PrintJSCode">
<xsl:with-param name="code">document.write(document.lastModified);</xsl:with-param>
</xsl:call-template>
</p>
</div>
</div>
</div>
<script src="{$jQueryURL}">
// Import JQuery, required for Bootstrap
</script>
<script src="{$bootstrapURL}/js/bootstrap.min.js">
// Import Bootstrap JS code
</script>
<script>
<xsl:text disable-output-escaping="yes">
$(function () { $("[data-toggle='tooltip']").tooltip(); });
$(function () { $("[data-toggle='popover']").popover(); });
var c = new Markdown.Converter();
$('.xs3p-doc').each(function(i, obj) {
var rawDocID = '#' + $(this).attr('id') + '-raw';
var indent = $(rawDocID).html().match("^\\n[\\t ]*");
if (!(indent === null)) {
normalized = $(rawDocID).html().replace(new RegExp(indent[0], "gm"), "\n");
} else {
normalized = $(rawDocID).html();
}
$(this).html(c.makeHtml(normalized));
$(this).find('code,pre').each(function(i, block) {
$(this).html($(this).text());
});
});
$(window).scroll(function() {
if ($(".xs3p-sidebar").css("position") == "fixed" && $(window).height() < $(".xs3p-sidebar").height()) {
var perc = $(window).scrollTop() / $("#xs3p-content").height();
var overflow = $(".xs3p-sidebar").height() + 105 - $(window).height();
$(".xs3p-sidebar").css("top", (65 - Math.round(overflow * perc)) + "px");
}
});
$(window).resize(function() {
if ($(".xs3p-sidebar").css("position") == "fixed") {
$(".xs3p-sidebar").css("top", "65px");
}
});
</xsl:text>
</script>
</body>
</html>
</xsl:template>
<!--
Prints out the table of Declared Namespaces for the
current schema.
-->
<xsl:template match="xsd:schema" mode="namespaces">
<xsl:call-template name="CollapseableBox">
<xsl:with-param name="id">
<xsl:call-template name="GetComponentID">
<xsl:with-param name="component" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="anchor">declared-namespaces</xsl:with-param>
<xsl:with-param name="styleClass">sample</xsl:with-param>
<xsl:with-param name="caption">Declared Namespaces</xsl:with-param>
<xsl:with-param name="contents">
<table class="table table-striped xs3p-in-panel-table">
<thead>
<tr>
<th>Prefix</th>
<th>Namespace</th>
</tr>
</thead>
<tbody>
<!-- Default namespace (no prefix) -->
<xsl:if test="namespace::*[local-name(.)='']">
<xsl:variable name="ns" select="namespace::*[local-name(.)='']"/>
<tr>
<td>
<a id="{$NS_PREFIX}">Default namespace</a>
</td>
<td>
<xsl:choose>
<xsl:when test="/xsd:schema/@targetNamespace and $ns=normalize-space(/xsd:schema/@targetNamespace)">
<span class="targetNS">
<xsl:value-of select="$ns"/>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$ns"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:if>
<!-- Namespaces with prefixes -->
<xsl:for-each select="namespace::*[local-name(.)!='']">
<xsl:variable name="prefix" select="local-name(.)"/>
<xsl:variable name="ns" select="."/>
<tr>
<td>
<a id="{concat($NS_PREFIX, $prefix)}">
<xsl:value-of select="$prefix"/>
</a>
</td>
<td>
<xsl:choose>
<xsl:when test="/xsd:schema/@targetNamespace and $ns=normalize-space(/xsd:schema/@targetNamespace)">
<span class="targetNS">
<xsl:value-of select="$ns"/>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$ns"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:with-param>
<xsl:with-param name="isOpened">true</xsl:with-param>
<xsl:with-param name="omitPanelContainer">true</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!--
Prints out the Table of Contents.
-->
<xsl:template match="xsd:schema" mode="toc">
<ul class="nav nav-list xs3p-sidenav">
<!-- Section: Schema Document Properties -->
<li>
<a href="#SchemaProperties">Schema Document Properties</a>
</li>
<!-- Section: Redefined Schema Components -->
<xsl:if test="xsd:redefine">
<li>
<a href="#Redefinitions">Redefined Schema Components</a>
</li>
</xsl:if>
<!-- Sections: Top-level Schema Components -->
<xsl:choose>
<!-- Sort schema components -->
<xsl:when test="normalize-space(translate($sortByComponent,'TRUE','true'))='true'">
<!-- Declarations -->
<xsl:if test="xsd:attribute or xsd:element">
<li><a href="#SchemaDeclarations">Global Declarations</a></li>
<xsl:apply-templates select="xsd:attribute | xsd:element" mode="toc">
<xsl:sort select="local-name(.)" order="ascending"/>
<xsl:sort select="@name" order="ascending"/>
</xsl:apply-templates>
</xsl:if>
<!-- Definitions -->
<xsl:if test="xsd:attributeGroup or xsd:complexType or xsd:group or xsd:notation or xsd:simpleType">
<li><a href="#SchemaDefinitions">Global Definitions</a></li>
<xsl:apply-templates select="xsd:attributeGroup | xsd:complexType | xsd:group | xsd:notation | xsd:simpleType" mode="toc">
<xsl:sort select="local-name(.)" order="ascending"/>
<xsl:sort select="@name" order="ascending"/>
</xsl:apply-templates>
</xsl:if>
</xsl:when>
<!-- Display schema components in order as they appear in schema -->
<xsl:otherwise>
<li><a href="#SchemaComponents">Global Schema Components</a></li>
<xsl:apply-templates select="xsd:attribute | xsd:attributeGroup | xsd:complexType | xsd:element | xsd:group | xsd:notation | xsd:simpleType" mode="toc"/>
</xsl:otherwise>
</xsl:choose>
<!-- Section: Glossary -->
<xsl:if test="normalize-space(translate($printGlossary,'TRUE','true'))='true'">
<li><a href="#Glossary">Glossary</a></li>
</xsl:if>
</ul>
</xsl:template>
<!--
Prints out a link to a top-level schema component section in the
Table of Contents.
-->
<xsl:template match="xsd:*[@name]" mode="toc">
<xsl:variable name="componentID">
<xsl:call-template name="GetComponentID">
<xsl:with-param name="component" select="."/>
</xsl:call-template>
</xsl:variable>
<li class="nav-sub-item">
<a href="#{$componentID}">
<xsl:call-template name="GetComponentDescription">
<xsl:with-param name="component" select="."/>
</xsl:call-template>
<xsl:text>: </xsl:text>
<strong><xsl:value-of select="@name"/></strong>
</a>
</li>
</xsl:template>
<!--
Prints out the section for a top-level schema component.
-->
<xsl:template match="xsd:*[@name]" mode="topSection">
<xsl:variable name="componentID">
<xsl:call-template name="GetComponentID">
<xsl:with-param name="component" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="ComponentSectionHeader">
<xsl:with-param name="component" select="."/>
</xsl:call-template>
<!-- Hierarchy table (for types and elements) -->
<xsl:apply-templates select="." mode="hierarchy"/>
<!-- Properties table -->
<xsl:apply-templates select="." mode="properties"/>
<!-- XML Instance Representation table -->
<xsl:call-template name="SampleInstanceTable">
<xsl:with-param name="component" select="."/>
</xsl:call-template>
<!-- Schema Component Representation table -->
<xsl:call-template name="SchemaComponentTable">
<xsl:with-param name="component" select="."/>
</xsl:call-template>
<!-- Footer -->
<xsl:call-template name="SectionFooter"/>
</xsl:template>
<!--
Prints out the section header of a top-level schema component.
Param(s):
component (Node) required
Top-level schema component
-->
<xsl:template name="ComponentSectionHeader">
<xsl:param name="component"/>
<xsl:variable name="componentID">
<xsl:call-template name="GetComponentID">
<xsl:with-param name="component" select="$component"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="componentDescription">
<xsl:call-template name="GetComponentDescription">
<xsl:with-param name="component" select="$component"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="componentTermRef">
<xsl:call-template name="GetComponentTermRef">
<xsl:with-param name="component" select="$component"/>
</xsl:call-template>
</xsl:variable>
<h3 class="xs3p-subsection-heading">
<!-- Description -->
<xsl:choose>
<xsl:when test="$componentTermRef != ''">
<xsl:call-template name="PrintGlossaryTermRef">
<xsl:with-param name="code" select="$componentTermRef"/>
<xsl:with-param name="term" select="$componentDescription"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$componentDescription"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>: </xsl:text>
<!-- Name -->
<a id="{$componentID}" class="name" data-html="true" data-placement="bottom" data-toggle="tooltip" title="Schema component name.">
<xsl:value-of select="$component/@name"/>
</a>
</h3>
</xsl:template>
<!--
Prints out footer for top-level sections.
-->
<xsl:template name="SectionFooter">
<!-- Link to top of page-->
<div style="text-align: right; clear: both;"><a href="#top" title="Go to top of page"><span class="glyphicon glyphicon-chevron-up"><xsl:text> </xsl:text></span></a></div>
<hr/>
</xsl:template>
<!--
Java Script code required by the entire HTML document.
-->
<xsl:template name="DocumentJSCode">
</xsl:template>
<!--
CSS properties for the entire HTML document.
-->
<xsl:template name="DocumentCSSStyles">
<xsl:text disable-output-escaping="yes">
/* XS3P specific CSS */
body {
background-color: #FFF;
padding-top: 50px;
}
.nav > li.active {
background-color: #FFF;
}
.nav > li > a:hover {
background-color: #CCC;
}
code {
color: #333;
}
.container-fluid {
padding: 15px 15px;
}
.nav-sub-item > a {
padding-left: 30px !important;
}
a.name {
padding-top: 65px;
}
h3.xs3p-subsection-heading {
margin-bottom: 30px;
}
section, #top {
margin-top: -65px;
padding-top: 65px;
}
pre {
padding: 5px;
}
.xs3p-sidenav {
padding-top: 10px;
padding-bottom: 10px;
background-color: #EEE;
border-radius: 10px;
}
.xs3p-navbar-title {
color: #FFF !important;
font-weight: bold;
}
.xs3p-in-panel-table {
margin-bottom: 0px;
}
.xs3p-sidebar {
position: static;
}
.xs3p-collapse-button {
font-size: 8pt;
}
.panel-heading .xs3p-panel-title:after {
font-family: 'Glyphicons Halflings';
content: "\e114";
float: left;
color: grey;
margin-right: 10px;
}
.panel-heading .xs3p-panel-title.collapsed:after {
content: "\e080";
}
.panel-info > .panel-heading .xs3p-panel-title:after {
color: white;
}
.xs3p-panel-help {
color: #CCCCCC;
cursor: pointer;
}
.panel-group {
margin-bottom: 20px;
}
.btn-doc {
padding: 0px;
border: 0px none;
background: none repeat scroll 0% 0% transparent;
line-height: 1;
font-size: 12px;
}
.unpre {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
white-space: normal;
word-break: normal;
word-wrap: normal;
}
.popover {
max-width: 400px;
}
// Syntax highlighting
.codehilite .err {color: #FFF; background-color: #D2322D; font-weight: bold;} /* Error */
.codehilite .c {color: #999;}
.codehilite .cs {color: #999; font-style: italic;}
.codehilite .nt {color: #2F6F9F;}
.codehilite .nn {color: #39B3D7;}
.codehilite .na {color: #47A447;}
.codehilite .s {color: #D2322D;}
.codehilite a {color: inherit !important; text-decoration: underline !important;}
.codehilite a:hover {opacity: 0.7 !important;}
@media (min-width: 992px) {
.xs3p-sidebar {
position: fixed;
top: 65px;
width: 22%;
}
}
</xsl:text>
</xsl:template>
<!--
Prints out all terms for the glossary section.
-->
<xsl:template name="Glossary">
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">Abstract</xsl:with-param>
<xsl:with-param name="term">Abstract</xsl:with-param>
<xsl:with-param name="description">
<xsl:text>(Applies to complex type definitions and element declarations).</xsl:text>
<xsl:text> An abstract element or complex type cannot used to validate an element instance.</xsl:text>
<xsl:text> If there is a reference to an abstract element, only element declarations that can substitute the abstract element can be used to validate the instance.</xsl:text>
<xsl:text> For references to abstract type definitions, only derived types can be used.</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">All</xsl:with-param>
<xsl:with-param name="term">All Model Group</xsl:with-param>
<xsl:with-param name="description">
<xsl:text>Child elements can be provided </xsl:text>
<em>
<xsl:text>in any order</xsl:text>
</em>
<xsl:text> in instances.</xsl:text>
</xsl:with-param>
<xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-all</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">Choice</xsl:with-param>
<xsl:with-param name="term">Choice Model Group</xsl:with-param>
<xsl:with-param name="description">
<em>
<xsl:text>Only one</xsl:text>
</em>
<xsl:text> from the list of child elements and model groups can be provided in instances.</xsl:text>
</xsl:with-param>
<xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-choice</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">CollapseWS</xsl:with-param>
<xsl:with-param name="term">Collapse Whitespace Policy</xsl:with-param>
<xsl:with-param name="description">Replace tab, line feed, and carriage return characters with space character (Unicode character 32). Then, collapse contiguous sequences of space characters into single space character, and remove leading and trailing space characters.</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">ElemBlock</xsl:with-param>
<xsl:with-param name="term">Disallowed Substitutions</xsl:with-param>
<xsl:with-param name="description">
<xsl:text>(Applies to element declarations).</xsl:text>
<xsl:text> If </xsl:text>
<em>substitution</em>
<xsl:text> is specified, then </xsl:text>
<xsl:call-template name="PrintGlossaryTermRef">
<xsl:with-param name="code">SubGroup</xsl:with-param>
<xsl:with-param name="term">substitution group</xsl:with-param>
</xsl:call-template>
<xsl:text> members cannot be used in place of the given element declaration to validate element instances.</xsl:text>
<xsl:text> If </xsl:text>
<em>derivation methods</em>
<xsl:text>, e.g. extension, restriction, are specified, then the given element declaration will not validate element instances that have types derived from the element declaration's type using the specified derivation methods.</xsl:text>
<xsl:text> Normally, element instances can override their declaration's type by specifying an </xsl:text>
<code>xsi:type</code>
<xsl:text> attribute.</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">Key</xsl:with-param>
<xsl:with-param name="term">Key Constraint</xsl:with-param>
<xsl:with-param name="description">
<xsl:text>Like </xsl:text>
<xsl:call-template name="PrintGlossaryTermRef">
<xsl:with-param name="code">Unique</xsl:with-param>
<xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>
</xsl:call-template>
<xsl:text>, but additionally requires that the specified value(s) must be provided.</xsl:text>
</xsl:with-param>
<xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">KeyRef</xsl:with-param>
<xsl:with-param name="term">Key Reference Constraint</xsl:with-param>
<xsl:with-param name="description">
<xsl:text>Ensures that the specified value(s) must match value(s) from a </xsl:text>
<xsl:call-template name="PrintGlossaryTermRef">
<xsl:with-param name="code">Key</xsl:with-param>
<xsl:with-param name="term">Key Constraint</xsl:with-param>
</xsl:call-template>
<xsl:text> or </xsl:text>
<xsl:call-template name="PrintGlossaryTermRef">
<xsl:with-param name="code">Unique</xsl:with-param>
<xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>
</xsl:call-template>
<xsl:text>.</xsl:text>
</xsl:with-param>
<xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">ModelGroup</xsl:with-param>
<xsl:with-param name="term">Model Group</xsl:with-param>
<xsl:with-param name="description">
<xsl:text>Groups together element content, specifying the order in which the element content can occur and the number of times the group of element content may be repeated.</xsl:text>
</xsl:with-param>
<xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#Model_Groups</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">Nillable</xsl:with-param>
<xsl:with-param name="term">Nillable</xsl:with-param>
<xsl:with-param name="description">
<xsl:text>(Applies to element declarations). </xsl:text>
<xsl:text>If an element declaration is nillable, instances can use the </xsl:text>
<code>xsi:nil</code>
<xsl:text> attribute.</xsl:text>
<xsl:text> The </xsl:text>
<code>xsi:nil</code>
<xsl:text> attribute is the boolean attribute, </xsl:text>
<em>nil</em>
<xsl:text>, from the </xsl:text>
<em>http://www.w3.org/2001/XMLSchema-instance</em>
<xsl:text> namespace.</xsl:text>
<xsl:text> If an element instance has an </xsl:text>
<code>xsi:nil</code>
<xsl:text> attribute set to true, it can be left empty, even though its element declaration may have required content.</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">Notation</xsl:with-param>
<xsl:with-param name="term">Notation</xsl:with-param>
<xsl:with-param name="description">A notation is used to identify the format of a piece of data. Values of elements and attributes that are of type, NOTATION, must come from the names of declared notations.</xsl:with-param>
<xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cNotation_Declarations</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">PreserveWS</xsl:with-param>
<xsl:with-param name="term">Preserve Whitespace Policy</xsl:with-param>
<xsl:with-param name="description">Preserve whitespaces exactly as they appear in instances.</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">TypeFinal</xsl:with-param>
<xsl:with-param name="term">Prohibited Derivations</xsl:with-param>
<xsl:with-param name="description">
<xsl:text>(Applies to type definitions). </xsl:text>
<xsl:text>Derivation methods that cannot be used to create sub-types from a given type definition.</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">
<xsl:with-param name="code">TypeBlock</xsl:with-param>
<xsl:with-param name="term">Prohibited Substitutions</xsl:with-param>
<xsl:with-param name="description">
<xsl:text>(Applies to complex type definitions). </xsl:text>
<xsl:text>Prevents sub-types that have been derived using the specified derivation methods from validating element instances in place of the given type definition.</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="PrintGlossaryTerm">