-
Notifications
You must be signed in to change notification settings - Fork 4
/
schemadoc2db.xsl
221 lines (207 loc) · 7.94 KB
/
schemadoc2db.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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<!--warning: this was hacked 2017-09-30 and attempted to be restored-->
<xsl:template match="/">
<xsl:result-document href="summary-namespaces-ent.xml">
<xsl:message select="'Creating entity with namespace summary'"/>
<xsl:comment>
To get an updated version of this entity file, please run the build process
and obtain a copy from the archive-only-not-in-final-distribution/new-entities
directory.
</xsl:comment><xsl:text>
</xsl:text>
<xsl:comment select="'a total of',count(/*/schema),'document types'"/>
<xsl:text>
</xsl:text>
<legalnotice role="namespaces">
<title>Declared XML Namespaces</title>
<simplelist lang="none">
<member>
urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 </member>
<member>
urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 </member>
<member>
urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2 </member>
<member>
urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2 </member>
<member>
urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataTypes-2 </member>
<member>
urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2 </member>
<member>
urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2 </member>
<member>
urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2
</member>
</simplelist>
<para conformance="skip"/>
<simplelist lang="none">
<xsl:for-each select="/schemadocs/schema">
<xsl:sort select="name"/>
<member>urn:oasis:names:specification:ubl:schema:xsd:<xsl:value-of
select="translate(normalize-space(name),' ','')"/>-2</member>
</xsl:for-each>
</simplelist>
</legalnotice>
</xsl:result-document>
<xsl:result-document href="summary-schemas-ent.xml">
<xsl:message select="'Creating entity with schema summaries'"/>
<xsl:comment>
To get an updated version of this entity file, please run the build process
and obtain a copy from the archive-only-not-in-final-distribution/new-entities
directory.
</xsl:comment><xsl:text>
</xsl:text>
<xsl:for-each select="/schemadocs/schema">
<xsl:sort select="name"/>
<xsl:variable name="normname" select="normalize-space(name)"/>
<xsl:variable name="compname" select="translate($normname,' ','')"/>
<section id="S-{translate(upper-case($normname),' ,()','-')}-SCHEMA">
<title><xsl:value-of select="$normname"/> Schema</title>
<para>
<xsl:text>Description: </xsl:text>
<xsl:apply-templates select="description/node()"/>
</para>
<informaltable>
<tgroup cols="2">
<colspec colwidth="30*"/>
<colspec colwidth="70*"/>
<tbody>
<row>
<entry><para>Processes involved</para></entry>
<entry>
<para>
<xsl:choose>
<xsl:when test="not(processes/process)">
<xsl:text>Any collaboration</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="processes/process">
<xsl:if test="position()>1">, </xsl:if>
<link linkend="S-{translate(upper-case(.),' ,()','-')}">
<xsl:value-of select="."/>
</link>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</para>
</entry>
</row>
<row>
<entry><para>Submitter role</para></entry>
<entry>
<para>
<xsl:value-of select="submitterRole"/>
</para>
</entry>
</row>
<row>
<entry><para>Receiver role</para></entry>
<entry>
<para>
<xsl:value-of select="receiverRole"/>
</para>
</entry>
</row>
<row>
<entry><para>Normative schema</para></entry>
<entry>
<para>
<literal>
<ulink url="xsd/maindoc/UBL-{$compname}-2.3.xsd"
>xsd/maindoc/UBL-<xsl:value-of select="$compname"/>-2.3.xsd</ulink>
</literal>
</para>
</entry>
</row>
<row>
<entry><para>Runtime schema</para></entry>
<entry>
<para>
<literal>
<ulink url="xsdrt/maindoc/UBL-{$compname}-2.3.xsd"
>xsdrt/maindoc/UBL-<xsl:value-of select="$compname"/>-2.3.xsd</ulink>
</literal>
</para>
</entry>
</row>
<row>
<entry><para>Summary report</para></entry>
<entry>
<para>
<literal>
<ulink url="mod/summary/reports/UBL-{$compname}-2.3.html"
>mod/summary/reports/UBL-<xsl:value-of
select="$compname"/>-2.3.html</ulink>
</literal>
</para>
</entry>
</row>
<xsl:for-each select="examples/example">
<xsl:if test="
not(matches(.,concat('UBL-',$compname,'-2\.\d-Example((-\d)|.*)?.xml')))">
<xsl:message terminate="yes" select="'Bad: ',.,'
Expecting:',
concat('UBL-',$compname,'-2\.\d-Example((-\d)|.*)?.xml')"/>
</xsl:if>
<row>
<entry><para>UBL <xsl:value-of select="normalize-space(
replace(.,'.+?-2.(.)-Example(-(\d)?.*)?.xml',
' 2.$1 example instance $3'))"/></para></entry>
<entry role="schemaExample">
<para>
<literal>
<ulink url="xml/{.}"
>xml/<xsl:value-of select="."/></ulink>
</literal>
</para>
</entry>
</row>
</xsl:for-each>
</tbody>
</tgroup>
</informaltable>
</section>
</xsl:for-each>
</xsl:result-document>
<xsl:result-document href="summary-examples-ent.xml">
<xsl:message select="'Creating entity with example list'"/>
<xsl:comment>
To get an updated version of this entity file, please run the build process
and obtain a copy from the archive-only-not-in-final-distribution/new-entities
directory.
</xsl:comment><xsl:text>
</xsl:text>
<blockquote role="summaryExamples">
<simplelist>
<xsl:for-each select="//example">
<xsl:sort select="." lang="en"/>
<member>
<literal>
<ulink url="xml/{.}">xml/<xsl:value-of select="."/></ulink>
</literal>
</member>
</xsl:for-each>
</simplelist>
</blockquote>
</xsl:result-document>
</xsl:template>
<xsl:template match="link[@schema]">
<link
linkend="S-{translate(upper-case(normalize-space(.)),' ,()','-')}-SCHEMA">
<xsl:value-of select="normalize-space(.)"/>
</link>
</xsl:template>
<xsl:template match="link">
<link linkend="S-{translate(upper-case(normalize-space(.)),' ,()','-')}">
<xsl:value-of select="normalize-space(.)"/>
</link>
</xsl:template>
<xsl:template match="link[@figure]">
<link linkend="F-{translate(upper-case(normalize-space(.)),' ,()','-')}">
<xsl:value-of select="normalize-space(.)"/>
</link>
</xsl:template>
<xsl:template match="*">
<xsl:message terminate="yes" select="'Not handled:',name(.)"/>
</xsl:template>
</xsl:stylesheet>