lxml 6.0.0__cp39-cp39-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lxml/ElementInclude.py +244 -0
- lxml/__init__.py +22 -0
- lxml/_elementpath.cp39-win_arm64.pyd +0 -0
- lxml/_elementpath.py +343 -0
- lxml/apihelpers.pxi +1801 -0
- lxml/builder.cp39-win_arm64.pyd +0 -0
- lxml/builder.py +243 -0
- lxml/classlookup.pxi +580 -0
- lxml/cleanup.pxi +215 -0
- lxml/cssselect.py +101 -0
- lxml/debug.pxi +36 -0
- lxml/docloader.pxi +178 -0
- lxml/doctestcompare.py +488 -0
- lxml/dtd.pxi +479 -0
- lxml/etree.cp39-win_arm64.pyd +0 -0
- lxml/etree.h +244 -0
- lxml/etree.pyx +3853 -0
- lxml/etree_api.h +204 -0
- lxml/extensions.pxi +830 -0
- lxml/html/ElementSoup.py +10 -0
- lxml/html/__init__.py +1927 -0
- lxml/html/_diffcommand.py +86 -0
- lxml/html/_difflib.cp39-win_arm64.pyd +0 -0
- lxml/html/_difflib.py +2106 -0
- lxml/html/_html5builder.py +100 -0
- lxml/html/_setmixin.py +56 -0
- lxml/html/builder.py +173 -0
- lxml/html/clean.py +21 -0
- lxml/html/defs.py +135 -0
- lxml/html/diff.cp39-win_arm64.pyd +0 -0
- lxml/html/diff.py +972 -0
- lxml/html/formfill.py +299 -0
- lxml/html/html5parser.py +260 -0
- lxml/html/soupparser.py +314 -0
- lxml/html/usedoctest.py +13 -0
- lxml/includes/__init__.pxd +0 -0
- lxml/includes/__init__.py +0 -0
- lxml/includes/c14n.pxd +25 -0
- lxml/includes/config.pxd +3 -0
- lxml/includes/dtdvalid.pxd +18 -0
- lxml/includes/etree_defs.h +379 -0
- lxml/includes/etreepublic.pxd +237 -0
- lxml/includes/extlibs/__init__.py +0 -0
- lxml/includes/extlibs/zconf.h +543 -0
- lxml/includes/extlibs/zlib.h +1938 -0
- lxml/includes/htmlparser.pxd +56 -0
- lxml/includes/libexslt/__init__.py +0 -0
- lxml/includes/libexslt/exslt.h +108 -0
- lxml/includes/libexslt/exsltconfig.h +70 -0
- lxml/includes/libexslt/exsltexports.h +63 -0
- lxml/includes/libexslt/libexslt.h +29 -0
- lxml/includes/libxml/HTMLparser.h +320 -0
- lxml/includes/libxml/HTMLtree.h +147 -0
- lxml/includes/libxml/SAX.h +204 -0
- lxml/includes/libxml/SAX2.h +173 -0
- lxml/includes/libxml/__init__.py +0 -0
- lxml/includes/libxml/c14n.h +128 -0
- lxml/includes/libxml/catalog.h +182 -0
- lxml/includes/libxml/chvalid.h +230 -0
- lxml/includes/libxml/debugXML.h +217 -0
- lxml/includes/libxml/dict.h +81 -0
- lxml/includes/libxml/encoding.h +233 -0
- lxml/includes/libxml/entities.h +151 -0
- lxml/includes/libxml/globals.h +529 -0
- lxml/includes/libxml/hash.h +236 -0
- lxml/includes/libxml/list.h +137 -0
- lxml/includes/libxml/nanoftp.h +186 -0
- lxml/includes/libxml/nanohttp.h +81 -0
- lxml/includes/libxml/parser.h +1265 -0
- lxml/includes/libxml/parserInternals.h +662 -0
- lxml/includes/libxml/pattern.h +100 -0
- lxml/includes/libxml/relaxng.h +218 -0
- lxml/includes/libxml/schemasInternals.h +958 -0
- lxml/includes/libxml/schematron.h +142 -0
- lxml/includes/libxml/threads.h +94 -0
- lxml/includes/libxml/tree.h +1314 -0
- lxml/includes/libxml/uri.h +94 -0
- lxml/includes/libxml/valid.h +448 -0
- lxml/includes/libxml/xinclude.h +129 -0
- lxml/includes/libxml/xlink.h +189 -0
- lxml/includes/libxml/xmlIO.h +369 -0
- lxml/includes/libxml/xmlautomata.h +146 -0
- lxml/includes/libxml/xmlerror.h +919 -0
- lxml/includes/libxml/xmlexports.h +50 -0
- lxml/includes/libxml/xmlmemory.h +228 -0
- lxml/includes/libxml/xmlmodule.h +57 -0
- lxml/includes/libxml/xmlreader.h +428 -0
- lxml/includes/libxml/xmlregexp.h +222 -0
- lxml/includes/libxml/xmlsave.h +88 -0
- lxml/includes/libxml/xmlschemas.h +246 -0
- lxml/includes/libxml/xmlschemastypes.h +152 -0
- lxml/includes/libxml/xmlstring.h +140 -0
- lxml/includes/libxml/xmlunicode.h +202 -0
- lxml/includes/libxml/xmlversion.h +526 -0
- lxml/includes/libxml/xmlwriter.h +488 -0
- lxml/includes/libxml/xpath.h +575 -0
- lxml/includes/libxml/xpathInternals.h +632 -0
- lxml/includes/libxml/xpointer.h +137 -0
- lxml/includes/libxslt/__init__.py +0 -0
- lxml/includes/libxslt/attributes.h +39 -0
- lxml/includes/libxslt/documents.h +93 -0
- lxml/includes/libxslt/extensions.h +262 -0
- lxml/includes/libxslt/extra.h +72 -0
- lxml/includes/libxslt/functions.h +78 -0
- lxml/includes/libxslt/imports.h +75 -0
- lxml/includes/libxslt/keys.h +53 -0
- lxml/includes/libxslt/libxslt.h +36 -0
- lxml/includes/libxslt/namespaces.h +68 -0
- lxml/includes/libxslt/numbersInternals.h +73 -0
- lxml/includes/libxslt/preproc.h +43 -0
- lxml/includes/libxslt/security.h +104 -0
- lxml/includes/libxslt/templates.h +77 -0
- lxml/includes/libxslt/transform.h +207 -0
- lxml/includes/libxslt/trio.h +216 -0
- lxml/includes/libxslt/triodef.h +220 -0
- lxml/includes/libxslt/variables.h +118 -0
- lxml/includes/libxslt/win32config.h +51 -0
- lxml/includes/libxslt/xslt.h +110 -0
- lxml/includes/libxslt/xsltInternals.h +1992 -0
- lxml/includes/libxslt/xsltconfig.h +179 -0
- lxml/includes/libxslt/xsltexports.h +64 -0
- lxml/includes/libxslt/xsltlocale.h +44 -0
- lxml/includes/libxslt/xsltutils.h +343 -0
- lxml/includes/lxml-version.h +3 -0
- lxml/includes/relaxng.pxd +64 -0
- lxml/includes/schematron.pxd +34 -0
- lxml/includes/tree.pxd +492 -0
- lxml/includes/uri.pxd +5 -0
- lxml/includes/xinclude.pxd +22 -0
- lxml/includes/xmlerror.pxd +852 -0
- lxml/includes/xmlparser.pxd +303 -0
- lxml/includes/xmlschema.pxd +35 -0
- lxml/includes/xpath.pxd +136 -0
- lxml/includes/xslt.pxd +190 -0
- lxml/isoschematron/__init__.py +348 -0
- lxml/isoschematron/resources/rng/iso-schematron.rng +709 -0
- lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl +75 -0
- lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl +77 -0
- lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl +313 -0
- lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl +1160 -0
- lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl +55 -0
- lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1796 -0
- lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +588 -0
- lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt +84 -0
- lxml/iterparse.pxi +438 -0
- lxml/lxml.etree.h +244 -0
- lxml/lxml.etree_api.h +204 -0
- lxml/nsclasses.pxi +281 -0
- lxml/objectify.cp39-win_arm64.pyd +0 -0
- lxml/objectify.pyx +2149 -0
- lxml/objectpath.pxi +332 -0
- lxml/parser.pxi +2059 -0
- lxml/parsertarget.pxi +180 -0
- lxml/proxy.pxi +619 -0
- lxml/public-api.pxi +178 -0
- lxml/pyclasslookup.py +3 -0
- lxml/readonlytree.pxi +565 -0
- lxml/relaxng.pxi +165 -0
- lxml/sax.cp39-win_arm64.pyd +0 -0
- lxml/sax.py +286 -0
- lxml/saxparser.pxi +875 -0
- lxml/schematron.pxi +173 -0
- lxml/serializer.pxi +1849 -0
- lxml/usedoctest.py +13 -0
- lxml/xinclude.pxi +67 -0
- lxml/xmlerror.pxi +1654 -0
- lxml/xmlid.pxi +179 -0
- lxml/xmlschema.pxi +215 -0
- lxml/xpath.pxi +487 -0
- lxml/xslt.pxi +957 -0
- lxml/xsltext.pxi +242 -0
- lxml-6.0.0.dist-info/METADATA +163 -0
- lxml-6.0.0.dist-info/RECORD +177 -0
- lxml-6.0.0.dist-info/WHEEL +5 -0
- lxml-6.0.0.dist-info/licenses/LICENSE.txt +31 -0
- lxml-6.0.0.dist-info/licenses/LICENSES.txt +29 -0
- lxml-6.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,588 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<!--
|
3
|
+
ISO_SVRL.xsl
|
4
|
+
|
5
|
+
Implementation of Schematron Validation Report Language from ISO Schematron
|
6
|
+
ISO/IEC 19757 Document Schema Definition Languages (DSDL)
|
7
|
+
Part 3: Rule-based validation Schematron
|
8
|
+
Annex D: Schematron Validation Report Language
|
9
|
+
|
10
|
+
This ISO Standard is available free as a Publicly Available Specification in PDF from ISO.
|
11
|
+
Also see www.schematron.com for drafts and other information.
|
12
|
+
|
13
|
+
This implementation of SVRL is designed to run with the "Skeleton" implementation
|
14
|
+
of Schematron which Oliver Becker devised. The skeleton code provides a
|
15
|
+
Schematron implementation but with named templates for handling all output;
|
16
|
+
the skeleton provides basic templates for output using this API, but client
|
17
|
+
validators can be written to import the skeleton and override the default output
|
18
|
+
templates as required. (In order to understand this, you must understand that
|
19
|
+
a named template such as "process-assert" in this XSLT stylesheet overrides and
|
20
|
+
replaces any template with the same name in the imported skeleton XSLT file.)
|
21
|
+
|
22
|
+
The other important thing to understand in this code is that there are different
|
23
|
+
versions of the Schematron skeleton. These track the development of Schematron through
|
24
|
+
Schematron 1.5, Schematron 1.6 and now ISO Schematron. One only skeleton must be
|
25
|
+
imported. The code has templates for the different skeletons commented out for
|
26
|
+
convenience. ISO Schematron has a different namespace than Schematron 1.5 and 1.6;
|
27
|
+
so the ISO Schematron skeleton has been written itself with an optional import
|
28
|
+
statement to in turn import the Schematron 1.6 skeleton. This will allow you to
|
29
|
+
validate with schemas from either namespace.
|
30
|
+
|
31
|
+
|
32
|
+
History:
|
33
|
+
2009-03-18
|
34
|
+
* Fix atrribute with space "see " which generates wrong name in some processors
|
35
|
+
2008-08-11
|
36
|
+
* RJ Fix attribute/@select which saxon allows in XSLT 1
|
37
|
+
2008-08-07
|
38
|
+
* RJ Add output-encoding attribute to specify final encoding to use
|
39
|
+
* Alter allow-foreign functionality so that Schematron span, emph and dir elements make
|
40
|
+
it to the output, for better formatting and because span can be used to mark up
|
41
|
+
semantically interesting information embedded in diagnostics, which reduces the
|
42
|
+
need to extend SVRL itself
|
43
|
+
* Diagnostic-reference had an invalid attribute @id that duplicated @diagnostic: removed
|
44
|
+
2008-08-06
|
45
|
+
* RJ Fix invalid output: svrl:diagnostic-reference is not contained in an svrl:text
|
46
|
+
* Output comment to SVRL file giving filename if available (from command-line parameter)
|
47
|
+
2008-08-04
|
48
|
+
* RJ move sch: prefix to schold: prefix to prevent confusion (we want people to
|
49
|
+
be able to switch from old namespace to new namespace without changing the
|
50
|
+
sch: prefix, so it is better to keep that prefix completely out of the XSLT)
|
51
|
+
* Extra signature fixes (PH)
|
52
|
+
2008-08-03
|
53
|
+
* Repair missing class parameter on process-p
|
54
|
+
2008-07-31
|
55
|
+
* Update skeleton names
|
56
|
+
2007-04-03
|
57
|
+
* Add option generate-fired-rule (RG)
|
58
|
+
2007-02-07
|
59
|
+
* Prefer true|false for parameters. But allow yes|no on some old for compatability
|
60
|
+
* DP Diagnostics output to svrl:text. Diagnosis put out after assertion text.
|
61
|
+
* Removed non-SVRL elements and attributes: better handled as an extra layer that invokes this one
|
62
|
+
* Add more formal parameters
|
63
|
+
* Correct confusion between $schemaVersion and $queryBinding
|
64
|
+
* Indent
|
65
|
+
* Validate against RNC schemas for XSLT 1 and 2 (with regex tests removed)
|
66
|
+
* Validate output with UniversalTest.sch against RNC schema for ISO SVRL
|
67
|
+
|
68
|
+
2007-02-01
|
69
|
+
* DP. Update formal parameters of overriding named templates to handle more attributes.
|
70
|
+
* DP. Refactor handling of rich and linkable parameters to a named template.
|
71
|
+
|
72
|
+
2007-01-22
|
73
|
+
* DP change svrl:ns to svrl:ns-in-attribute-value
|
74
|
+
* Change default when no queryBinding from "unknown" to "xslt"
|
75
|
+
|
76
|
+
2007-01-18:
|
77
|
+
* Improve documentation
|
78
|
+
* KH Add command-line options to generate paths or not
|
79
|
+
* Use axsl:attribute rather than xsl:attribute to shut XSLT2 up
|
80
|
+
* Add extra command-line options to pass to the iso_schematron_skeleton
|
81
|
+
|
82
|
+
2006-12-01: iso_svrl.xsl Rick Jelliffe,
|
83
|
+
* update namespace,
|
84
|
+
* update phase handling,
|
85
|
+
* add flag param to process-assert and process-report & @ flag on output
|
86
|
+
|
87
|
+
2001: Conformance1-5.xsl Rick Jelliffe,
|
88
|
+
* Created, using the skeleton code contributed by Oliver Becker
|
89
|
+
-->
|
90
|
+
<!--
|
91
|
+
Derived from Conformance1-5.xsl.
|
92
|
+
|
93
|
+
Copyright (c) 2001, 2006 Rick Jelliffe and Academia Sinica Computing Center, Taiwan
|
94
|
+
|
95
|
+
This software is provided 'as-is', without any express or implied warranty.
|
96
|
+
In no event will the authors be held liable for any damages arising from
|
97
|
+
the use of this software.
|
98
|
+
|
99
|
+
Permission is granted to anyone to use this software for any purpose,
|
100
|
+
including commercial applications, and to alter it and redistribute it freely,
|
101
|
+
subject to the following restrictions:
|
102
|
+
|
103
|
+
1. The origin of this software must not be misrepresented; you must not claim
|
104
|
+
that you wrote the original software. If you use this software in a product,
|
105
|
+
an acknowledgment in the product documentation would be appreciated but is
|
106
|
+
not required.
|
107
|
+
|
108
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
109
|
+
misrepresented as being the original software.
|
110
|
+
|
111
|
+
3. This notice may not be removed or altered from any source distribution.
|
112
|
+
-->
|
113
|
+
|
114
|
+
<!-- Ideas nabbed from schematrons by Francis N., Miloslav N. and David C. -->
|
115
|
+
|
116
|
+
<!-- The command-line parameters are:
|
117
|
+
phase NMTOKEN | "#ALL" (default) Select the phase for validation
|
118
|
+
allow-foreign "true" | "false" (default) Pass non-Schematron elements and rich markup to the generated stylesheet
|
119
|
+
diagnose= true | false|yes|no Add the diagnostics to the assertion test in reports (yes|no are obsolete)
|
120
|
+
generate-paths=true|false|yes|no generate the @location attribute with XPaths (yes|no are obsolete)
|
121
|
+
sch.exslt.imports semi-colon delimited string of filenames for some EXSLT implementations
|
122
|
+
optimize "visit-no-attributes" Use only when the schema has no attributes as the context nodes
|
123
|
+
generate-fired-rule "true"(default) | "false" Generate fired-rule elements
|
124
|
+
|
125
|
+
-->
|
126
|
+
|
127
|
+
<xsl:stylesheet
|
128
|
+
version="1.0"
|
129
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
130
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
131
|
+
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
|
132
|
+
xmlns:schold="http://www.ascc.net/xml/schematron"
|
133
|
+
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
|
134
|
+
xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
|
135
|
+
>
|
136
|
+
|
137
|
+
<!-- Select the import statement and adjust the path as
|
138
|
+
necessary for your system.
|
139
|
+
If not XSLT2 then also remove svrl:active-pattern/@document="{document-uri()}" from process-pattern()
|
140
|
+
-->
|
141
|
+
<!--
|
142
|
+
<xsl:import href="iso_schematron_skeleton_for_saxon.xsl"/>
|
143
|
+
-->
|
144
|
+
|
145
|
+
<xsl:import href="iso_schematron_skeleton_for_xslt1.xsl"/>
|
146
|
+
<!--
|
147
|
+
<xsl:import href="iso_schematron_skeleton.xsl"/>
|
148
|
+
<xsl:import href="skeleton1-5.xsl"/>
|
149
|
+
<xsl:import href="skeleton1-6.xsl"/>
|
150
|
+
-->
|
151
|
+
|
152
|
+
<xsl:param name="diagnose" >true</xsl:param>
|
153
|
+
<xsl:param name="phase" >
|
154
|
+
<xsl:choose>
|
155
|
+
<!-- Handle Schematron 1.5 and 1.6 phases -->
|
156
|
+
<xsl:when test="//schold:schema/@defaultPhase">
|
157
|
+
<xsl:value-of select="//schold:schema/@defaultPhase"/>
|
158
|
+
</xsl:when>
|
159
|
+
<!-- Handle ISO Schematron phases -->
|
160
|
+
<xsl:when test="//iso:schema/@defaultPhase">
|
161
|
+
<xsl:value-of select="//iso:schema/@defaultPhase"/>
|
162
|
+
</xsl:when>
|
163
|
+
<xsl:otherwise>#ALL</xsl:otherwise>
|
164
|
+
</xsl:choose>
|
165
|
+
</xsl:param>
|
166
|
+
<xsl:param name="allow-foreign" >false</xsl:param>
|
167
|
+
<xsl:param name="generate-paths" >true</xsl:param>
|
168
|
+
<xsl:param name="generate-fired-rule" >true</xsl:param>
|
169
|
+
<xsl:param name="optimize"/>
|
170
|
+
|
171
|
+
<xsl:param name="output-encoding" ></xsl:param>
|
172
|
+
|
173
|
+
<!-- e.g. saxon file.xml file.xsl "sch.exslt.imports=.../string.xsl;.../math.xsl" -->
|
174
|
+
<xsl:param name="sch.exslt.imports" />
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<!-- Experimental: If this file called, then must be generating svrl -->
|
179
|
+
<xsl:variable name="svrlTest" select="true()" />
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<!-- ================================================================ -->
|
184
|
+
|
185
|
+
<xsl:template name="process-prolog">
|
186
|
+
<axsl:output method="xml" omit-xml-declaration="no" standalone="yes"
|
187
|
+
indent="yes">
|
188
|
+
<xsl:if test=" string-length($output-encoding) > 0">
|
189
|
+
<xsl:attribute name="encoding"><xsl:value-of select=" $output-encoding" /></xsl:attribute>
|
190
|
+
</xsl:if>
|
191
|
+
</axsl:output>
|
192
|
+
|
193
|
+
</xsl:template>
|
194
|
+
|
195
|
+
<!-- Overrides skeleton.xsl -->
|
196
|
+
<xsl:template name="process-root">
|
197
|
+
<xsl:param name="title"/>
|
198
|
+
<xsl:param name="contents" />
|
199
|
+
<xsl:param name="queryBinding" >xslt1</xsl:param>
|
200
|
+
<xsl:param name="schemaVersion" />
|
201
|
+
<xsl:param name="id" />
|
202
|
+
<xsl:param name="version"/>
|
203
|
+
<!-- "Rich" parameters -->
|
204
|
+
<xsl:param name="fpi" />
|
205
|
+
<xsl:param name="icon" />
|
206
|
+
<xsl:param name="lang" />
|
207
|
+
<xsl:param name="see" />
|
208
|
+
<xsl:param name="space" />
|
209
|
+
|
210
|
+
<svrl:schematron-output title="{$title}" schemaVersion="{$schemaVersion}" >
|
211
|
+
<xsl:if test=" string-length( normalize-space( $phase )) > 0 and
|
212
|
+
not( normalize-space( $phase ) = '#ALL') ">
|
213
|
+
<axsl:attribute name="phase">
|
214
|
+
<xsl:value-of select=" $phase " />
|
215
|
+
</axsl:attribute>
|
216
|
+
</xsl:if>
|
217
|
+
<xsl:if test=" $allow-foreign = 'true'">
|
218
|
+
</xsl:if>
|
219
|
+
<xsl:if test=" $allow-foreign = 'true'">
|
220
|
+
|
221
|
+
<xsl:call-template name='richParms'>
|
222
|
+
<xsl:with-param name="fpi" select="$fpi" />
|
223
|
+
<xsl:with-param name="icon" select="$icon"/>
|
224
|
+
<xsl:with-param name="lang" select="$lang"/>
|
225
|
+
<xsl:with-param name="see" select="$see" />
|
226
|
+
<xsl:with-param name="space" select="$space" />
|
227
|
+
</xsl:call-template>
|
228
|
+
</xsl:if>
|
229
|
+
|
230
|
+
<axsl:comment><axsl:value-of select="$archiveDirParameter"/>  
|
231
|
+
<axsl:value-of select="$archiveNameParameter"/>  
|
232
|
+
<axsl:value-of select="$fileNameParameter"/>  
|
233
|
+
<axsl:value-of select="$fileDirParameter"/></axsl:comment>
|
234
|
+
|
235
|
+
|
236
|
+
<xsl:apply-templates mode="do-schema-p" />
|
237
|
+
<xsl:copy-of select="$contents" />
|
238
|
+
</svrl:schematron-output>
|
239
|
+
</xsl:template>
|
240
|
+
|
241
|
+
|
242
|
+
<xsl:template name="process-assert">
|
243
|
+
<xsl:param name="test"/>
|
244
|
+
<xsl:param name="diagnostics" />
|
245
|
+
<xsl:param name="id" />
|
246
|
+
<xsl:param name="flag" />
|
247
|
+
<!-- "Linkable" parameters -->
|
248
|
+
<xsl:param name="role"/>
|
249
|
+
<xsl:param name="subject"/>
|
250
|
+
<!-- "Rich" parameters -->
|
251
|
+
<xsl:param name="fpi" />
|
252
|
+
<xsl:param name="icon" />
|
253
|
+
<xsl:param name="lang" />
|
254
|
+
<xsl:param name="see" />
|
255
|
+
<xsl:param name="space" />
|
256
|
+
<svrl:failed-assert test="{$test}" >
|
257
|
+
<xsl:if test="string-length( $id ) > 0">
|
258
|
+
<axsl:attribute name="id">
|
259
|
+
<xsl:value-of select=" $id " />
|
260
|
+
</axsl:attribute>
|
261
|
+
</xsl:if>
|
262
|
+
<xsl:if test=" string-length( $flag ) > 0">
|
263
|
+
<axsl:attribute name="flag">
|
264
|
+
<xsl:value-of select=" $flag " />
|
265
|
+
</axsl:attribute>
|
266
|
+
</xsl:if>
|
267
|
+
<!-- Process rich attributes. -->
|
268
|
+
<xsl:call-template name="richParms">
|
269
|
+
<xsl:with-param name="fpi" select="$fpi"/>
|
270
|
+
<xsl:with-param name="icon" select="$icon"/>
|
271
|
+
<xsl:with-param name="lang" select="$lang"/>
|
272
|
+
<xsl:with-param name="see" select="$see" />
|
273
|
+
<xsl:with-param name="space" select="$space" />
|
274
|
+
</xsl:call-template>
|
275
|
+
<xsl:call-template name='linkableParms'>
|
276
|
+
<xsl:with-param name="role" select="$role" />
|
277
|
+
<xsl:with-param name="subject" select="$subject"/>
|
278
|
+
</xsl:call-template>
|
279
|
+
<xsl:if test=" $generate-paths = 'true' or $generate-paths= 'yes' ">
|
280
|
+
<!-- true/false is the new way -->
|
281
|
+
<axsl:attribute name="location">
|
282
|
+
<axsl:apply-templates select="." mode="schematron-get-full-path"/>
|
283
|
+
</axsl:attribute>
|
284
|
+
</xsl:if>
|
285
|
+
|
286
|
+
<svrl:text>
|
287
|
+
<xsl:apply-templates mode="text" />
|
288
|
+
|
289
|
+
</svrl:text>
|
290
|
+
<xsl:if test="$diagnose = 'yes' or $diagnose= 'true' ">
|
291
|
+
<!-- true/false is the new way -->
|
292
|
+
<xsl:call-template name="diagnosticsSplit">
|
293
|
+
<xsl:with-param name="str" select="$diagnostics"/>
|
294
|
+
</xsl:call-template>
|
295
|
+
</xsl:if>
|
296
|
+
</svrl:failed-assert>
|
297
|
+
</xsl:template>
|
298
|
+
|
299
|
+
<xsl:template name="process-report">
|
300
|
+
<xsl:param name="id"/>
|
301
|
+
<xsl:param name="test"/>
|
302
|
+
<xsl:param name="diagnostics"/>
|
303
|
+
<xsl:param name="flag" />
|
304
|
+
<!-- "Linkable" parameters -->
|
305
|
+
<xsl:param name="role"/>
|
306
|
+
<xsl:param name="subject"/>
|
307
|
+
<!-- "Rich" parameters -->
|
308
|
+
<xsl:param name="fpi" />
|
309
|
+
<xsl:param name="icon" />
|
310
|
+
<xsl:param name="lang" />
|
311
|
+
<xsl:param name="see" />
|
312
|
+
<xsl:param name="space" />
|
313
|
+
<svrl:successful-report test="{$test}" >
|
314
|
+
<xsl:if test=" string-length( $id ) > 0">
|
315
|
+
<axsl:attribute name="id">
|
316
|
+
<xsl:value-of select=" $id " />
|
317
|
+
</axsl:attribute>
|
318
|
+
</xsl:if>
|
319
|
+
<xsl:if test=" string-length( $flag ) > 0">
|
320
|
+
<axsl:attribute name="flag">
|
321
|
+
<xsl:value-of select=" $flag " />
|
322
|
+
</axsl:attribute>
|
323
|
+
</xsl:if>
|
324
|
+
|
325
|
+
<!-- Process rich attributes. -->
|
326
|
+
<xsl:call-template name="richParms">
|
327
|
+
<xsl:with-param name="fpi" select="$fpi"/>
|
328
|
+
<xsl:with-param name="icon" select="$icon"/>
|
329
|
+
<xsl:with-param name="lang" select="$lang"/>
|
330
|
+
<xsl:with-param name="see" select="$see" />
|
331
|
+
<xsl:with-param name="space" select="$space" />
|
332
|
+
</xsl:call-template>
|
333
|
+
<xsl:call-template name='linkableParms'>
|
334
|
+
<xsl:with-param name="role" select="$role" />
|
335
|
+
<xsl:with-param name="subject" select="$subject"/>
|
336
|
+
</xsl:call-template>
|
337
|
+
<xsl:if test=" $generate-paths = 'yes' or $generate-paths = 'true' ">
|
338
|
+
<!-- true/false is the new way -->
|
339
|
+
<axsl:attribute name="location">
|
340
|
+
<axsl:apply-templates select="." mode="schematron-get-full-path"/>
|
341
|
+
</axsl:attribute>
|
342
|
+
</xsl:if>
|
343
|
+
|
344
|
+
<svrl:text>
|
345
|
+
<xsl:apply-templates mode="text" />
|
346
|
+
|
347
|
+
</svrl:text>
|
348
|
+
<xsl:if test="$diagnose = 'yes' or $diagnose='true' ">
|
349
|
+
<!-- true/false is the new way -->
|
350
|
+
<xsl:call-template name="diagnosticsSplit">
|
351
|
+
<xsl:with-param name="str" select="$diagnostics"/>
|
352
|
+
</xsl:call-template>
|
353
|
+
</xsl:if>
|
354
|
+
</svrl:successful-report>
|
355
|
+
</xsl:template>
|
356
|
+
|
357
|
+
|
358
|
+
<!-- Overrides skeleton -->
|
359
|
+
<xsl:template name="process-dir" >
|
360
|
+
<xsl:param name="value" />
|
361
|
+
<xsl:choose>
|
362
|
+
<xsl:when test=" $allow-foreign = 'true'">
|
363
|
+
<xsl:copy-of select="."/>
|
364
|
+
</xsl:when>
|
365
|
+
|
366
|
+
<xsl:otherwise>
|
367
|
+
<!-- We generate too much whitespace rather than risking concatenation -->
|
368
|
+
<axsl:text> </axsl:text>
|
369
|
+
<xsl:apply-templates mode="inline-text"/>
|
370
|
+
<axsl:text> </axsl:text>
|
371
|
+
</xsl:otherwise>
|
372
|
+
</xsl:choose>
|
373
|
+
</xsl:template>
|
374
|
+
|
375
|
+
<xsl:template name="process-diagnostic">
|
376
|
+
<xsl:param name="id"/>
|
377
|
+
<!-- Rich parameters -->
|
378
|
+
<xsl:param name="fpi" />
|
379
|
+
<xsl:param name="icon" />
|
380
|
+
<xsl:param name="lang" />
|
381
|
+
<xsl:param name="see" />
|
382
|
+
<xsl:param name="space" />
|
383
|
+
<svrl:diagnostic-reference diagnostic="{$id}" >
|
384
|
+
|
385
|
+
<xsl:call-template name="richParms">
|
386
|
+
<xsl:with-param name="fpi" select="$fpi"/>
|
387
|
+
<xsl:with-param name="icon" select="$icon"/>
|
388
|
+
<xsl:with-param name="lang" select="$lang"/>
|
389
|
+
<xsl:with-param name="see" select="$see" />
|
390
|
+
<xsl:with-param name="space" select="$space" />
|
391
|
+
</xsl:call-template>
|
392
|
+
<xsl:text>
|
393
|
+
</xsl:text>
|
394
|
+
|
395
|
+
<xsl:apply-templates mode="text"/>
|
396
|
+
|
397
|
+
</svrl:diagnostic-reference>
|
398
|
+
</xsl:template>
|
399
|
+
|
400
|
+
|
401
|
+
<!-- Overrides skeleton -->
|
402
|
+
<xsl:template name="process-emph" >
|
403
|
+
<xsl:param name="class" />
|
404
|
+
<xsl:choose>
|
405
|
+
<xsl:when test=" $allow-foreign = 'true'">
|
406
|
+
<xsl:copy-of select="."/>
|
407
|
+
</xsl:when>
|
408
|
+
<xsl:otherwise>
|
409
|
+
<!-- We generate too much whitespace rather than risking concatenation -->
|
410
|
+
<axsl:text> </axsl:text>
|
411
|
+
<xsl:apply-templates mode="inline-text"/>
|
412
|
+
<axsl:text> </axsl:text>
|
413
|
+
</xsl:otherwise>
|
414
|
+
</xsl:choose>
|
415
|
+
</xsl:template>
|
416
|
+
|
417
|
+
<xsl:template name="process-rule">
|
418
|
+
<xsl:param name="id"/>
|
419
|
+
<xsl:param name="context"/>
|
420
|
+
<xsl:param name="flag"/>
|
421
|
+
<!-- "Linkable" parameters -->
|
422
|
+
<xsl:param name="role"/>
|
423
|
+
<xsl:param name="subject"/>
|
424
|
+
<!-- "Rich" parameters -->
|
425
|
+
<xsl:param name="fpi" />
|
426
|
+
<xsl:param name="icon" />
|
427
|
+
<xsl:param name="lang" />
|
428
|
+
<xsl:param name="see" />
|
429
|
+
<xsl:param name="space" />
|
430
|
+
<xsl:if test=" $generate-fired-rule = 'true'">
|
431
|
+
<svrl:fired-rule context="{$context}" >
|
432
|
+
<!-- Process rich attributes. -->
|
433
|
+
<xsl:call-template name="richParms">
|
434
|
+
<xsl:with-param name="fpi" select="$fpi"/>
|
435
|
+
<xsl:with-param name="icon" select="$icon"/>
|
436
|
+
<xsl:with-param name="lang" select="$lang"/>
|
437
|
+
<xsl:with-param name="see" select="$see" />
|
438
|
+
<xsl:with-param name="space" select="$space" />
|
439
|
+
</xsl:call-template>
|
440
|
+
<xsl:if test=" string( $id )">
|
441
|
+
<xsl:attribute name="id">
|
442
|
+
<xsl:value-of select=" $id " />
|
443
|
+
</xsl:attribute>
|
444
|
+
</xsl:if>
|
445
|
+
<xsl:if test=" string-length( $role ) > 0">
|
446
|
+
<xsl:attribute name="role">
|
447
|
+
<xsl:value-of select=" $role " />
|
448
|
+
</xsl:attribute>
|
449
|
+
</xsl:if>
|
450
|
+
</svrl:fired-rule>
|
451
|
+
</xsl:if>
|
452
|
+
</xsl:template>
|
453
|
+
|
454
|
+
<xsl:template name="process-ns">
|
455
|
+
<xsl:param name="prefix"/>
|
456
|
+
<xsl:param name="uri"/>
|
457
|
+
<svrl:ns-prefix-in-attribute-values uri="{$uri}" prefix="{$prefix}" />
|
458
|
+
</xsl:template>
|
459
|
+
|
460
|
+
<xsl:template name="process-p">
|
461
|
+
<xsl:param name="icon"/>
|
462
|
+
<xsl:param name="class"/>
|
463
|
+
<xsl:param name="id"/>
|
464
|
+
<xsl:param name="lang"/>
|
465
|
+
|
466
|
+
<svrl:text>
|
467
|
+
<xsl:apply-templates mode="text"/>
|
468
|
+
</svrl:text>
|
469
|
+
</xsl:template>
|
470
|
+
|
471
|
+
<xsl:template name="process-pattern">
|
472
|
+
<xsl:param name="name"/>
|
473
|
+
<xsl:param name="id"/>
|
474
|
+
<xsl:param name="is-a"/>
|
475
|
+
|
476
|
+
<!-- "Rich" parameters -->
|
477
|
+
<xsl:param name="fpi" />
|
478
|
+
<xsl:param name="icon" />
|
479
|
+
<xsl:param name="lang" />
|
480
|
+
<xsl:param name="see" />
|
481
|
+
<xsl:param name="space" />
|
482
|
+
<svrl:active-pattern >
|
483
|
+
<xsl:if test=" string( $id )">
|
484
|
+
<axsl:attribute name="id">
|
485
|
+
<xsl:value-of select=" $id " />
|
486
|
+
</axsl:attribute>
|
487
|
+
</xsl:if>
|
488
|
+
<xsl:if test=" string( $name )">
|
489
|
+
<axsl:attribute name="name">
|
490
|
+
<xsl:value-of select=" $name " />
|
491
|
+
</axsl:attribute>
|
492
|
+
</xsl:if>
|
493
|
+
|
494
|
+
<xsl:call-template name='richParms'>
|
495
|
+
<xsl:with-param name="fpi" select="$fpi"/>
|
496
|
+
<xsl:with-param name="icon" select="$icon"/>
|
497
|
+
<xsl:with-param name="lang" select="$lang"/>
|
498
|
+
<xsl:with-param name="see" select="$see" />
|
499
|
+
<xsl:with-param name="space" select="$space" />
|
500
|
+
</xsl:call-template>
|
501
|
+
|
502
|
+
<!-- ?? report that this screws up iso:title processing -->
|
503
|
+
<xsl:apply-templates mode="do-pattern-p"/>
|
504
|
+
<!-- ?? Seems that this apply-templates is never triggered DP -->
|
505
|
+
<axsl:apply-templates />
|
506
|
+
</svrl:active-pattern>
|
507
|
+
</xsl:template>
|
508
|
+
|
509
|
+
<!-- Overrides skeleton -->
|
510
|
+
<xsl:template name="process-message" >
|
511
|
+
<xsl:param name="pattern"/>
|
512
|
+
<xsl:param name="role"/>
|
513
|
+
</xsl:template>
|
514
|
+
|
515
|
+
|
516
|
+
<!-- Overrides skeleton -->
|
517
|
+
<xsl:template name="process-span" >
|
518
|
+
<xsl:param name="class" />
|
519
|
+
<xsl:choose>
|
520
|
+
<xsl:when test=" $allow-foreign = 'true'">
|
521
|
+
<xsl:copy-of select="."/>
|
522
|
+
</xsl:when>
|
523
|
+
<xsl:otherwise>
|
524
|
+
<!-- We generate too much whitespace rather than risking concatenation -->
|
525
|
+
<axsl:text> </axsl:text>
|
526
|
+
<xsl:apply-templates mode="inline-text"/>
|
527
|
+
<axsl:text> </axsl:text>
|
528
|
+
</xsl:otherwise>
|
529
|
+
</xsl:choose>
|
530
|
+
</xsl:template>
|
531
|
+
|
532
|
+
<!-- =========================================================================== -->
|
533
|
+
<!-- processing rich parameters. -->
|
534
|
+
<xsl:template name='richParms'>
|
535
|
+
<!-- "Rich" parameters -->
|
536
|
+
<xsl:param name="fpi" />
|
537
|
+
<xsl:param name="icon" />
|
538
|
+
<xsl:param name="lang" />
|
539
|
+
<xsl:param name="see" />
|
540
|
+
<xsl:param name="space" />
|
541
|
+
<!-- Process rich attributes. -->
|
542
|
+
<xsl:if test=" $allow-foreign = 'true'">
|
543
|
+
<xsl:if test="string($fpi)">
|
544
|
+
<axsl:attribute name="fpi">
|
545
|
+
<xsl:value-of select="$fpi"/>
|
546
|
+
</axsl:attribute>
|
547
|
+
</xsl:if>
|
548
|
+
<xsl:if test="string($icon)">
|
549
|
+
<axsl:attribute name="icon">
|
550
|
+
<xsl:value-of select="$icon"/>
|
551
|
+
</axsl:attribute>
|
552
|
+
</xsl:if>
|
553
|
+
<xsl:if test="string($see)">
|
554
|
+
<axsl:attribute name="see">
|
555
|
+
<xsl:value-of select="$see"/>
|
556
|
+
</axsl:attribute>
|
557
|
+
</xsl:if>
|
558
|
+
</xsl:if>
|
559
|
+
<xsl:if test="string($space)">
|
560
|
+
<axsl:attribute name="xml:space">
|
561
|
+
<xsl:value-of select="$space"/>
|
562
|
+
</axsl:attribute>
|
563
|
+
</xsl:if>
|
564
|
+
<xsl:if test="string($lang)">
|
565
|
+
<axsl:attribute name="xml:lang">
|
566
|
+
<xsl:value-of select="$lang"/>
|
567
|
+
</axsl:attribute>
|
568
|
+
</xsl:if>
|
569
|
+
</xsl:template>
|
570
|
+
|
571
|
+
<!-- processing linkable parameters. -->
|
572
|
+
<xsl:template name='linkableParms'>
|
573
|
+
<xsl:param name="role"/>
|
574
|
+
<xsl:param name="subject"/>
|
575
|
+
|
576
|
+
<!-- ISO SVRL has a role attribute to match the Schematron role attribute -->
|
577
|
+
<xsl:if test=" string($role )">
|
578
|
+
<axsl:attribute name="role">
|
579
|
+
<xsl:value-of select=" $role " />
|
580
|
+
</axsl:attribute>
|
581
|
+
</xsl:if>
|
582
|
+
<!-- ISO SVRL does not have a subject attribute to match the Schematron subject attribute.
|
583
|
+
Instead, the Schematron subject attribute is folded into the location attribute -->
|
584
|
+
</xsl:template>
|
585
|
+
|
586
|
+
|
587
|
+
</xsl:stylesheet>
|
588
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
ISO SCHEMATRON 2010
|
2
|
+
|
3
|
+
XSLT implementation by Rick Jelliffe with assistance from members of Schematron-love-in maillist.
|
4
|
+
|
5
|
+
2010-04-21
|
6
|
+
|
7
|
+
Two distributions are available. One is for XSLT1 engines.
|
8
|
+
The other is for XSLT2 engines, such as SAXON 9.
|
9
|
+
|
10
|
+
|
11
|
+
This version of Schematron splits the process into a pipeline of several different XSLT stages.
|
12
|
+
|
13
|
+
1) First, preprocess your Schematron schema with iso_dsdl_include.xsl.
|
14
|
+
This is a macro processor to assemble the schema from various parts.
|
15
|
+
If your schema is not in separate parts, you can skip this stage.
|
16
|
+
This stage also generates error messages for some common XPath syntax problems.
|
17
|
+
|
18
|
+
2) Second, preprocess the output from stage 1 with iso_abstract_expand.xsl.
|
19
|
+
This is a macro processor to convert abstract patterns to real patterns.
|
20
|
+
If your schema does not use abstract patterns, you can skip this
|
21
|
+
stage.
|
22
|
+
|
23
|
+
3) Third, compile the Schematron schema into an XSLT script.
|
24
|
+
This will typically use iso_svrl_for_xslt1.xsl or iso_svrl_for_xslt2.xsl
|
25
|
+
(which in turn invoke iso_schematron_skeleton_for_xslt1.xsl or iso_schematron_skeleton_for_saxon.xsl)
|
26
|
+
However, other "meta-stylesheets" are also in common use; the principle of operation is the same.
|
27
|
+
If your schema uses Schematron phases, supply these as command line/invocation parameters
|
28
|
+
to this process.
|
29
|
+
|
30
|
+
4) Fourth, run the script generated by stage 3 against the document being validated.
|
31
|
+
If you are using the SVRL script, then the output of validation will be an XML document.
|
32
|
+
If your schema uses Schematron parameters, supply these as command line/invocation parameters
|
33
|
+
to this process.
|
34
|
+
|
35
|
+
|
36
|
+
The XSLT2 distribution also features several next generation features,
|
37
|
+
such as validating multiple documents. See the source code for details.
|
38
|
+
|
39
|
+
Schematron assertions can be written in any language, of course; the file
|
40
|
+
sch-messages-en.xhtml contains the diagnostics messages from the XSLT2 skeleton
|
41
|
+
in English, and this can be used as template to localize the skeleton's
|
42
|
+
error messages. Note that typically programming errors in Schematron are XPath
|
43
|
+
errors, which requires localized messages from the XSLT engine.
|
44
|
+
|
45
|
+
ANT
|
46
|
+
---
|
47
|
+
To give an example of how to process a document, here is a sample ANT task.
|
48
|
+
|
49
|
+
<target name="schematron-compile-test" >
|
50
|
+
|
51
|
+
<!-- expand inclusions -->
|
52
|
+
<xslt basedir="test/schematron"
|
53
|
+
style="iso_dsdl_include.xsl" in="test.sch" out="test1.sch">
|
54
|
+
<classpath>
|
55
|
+
<pathelement location="${lib.dir}/saxon9.jar"/>
|
56
|
+
</classpath>
|
57
|
+
</xslt>
|
58
|
+
|
59
|
+
<!-- expand abstract patterns -->
|
60
|
+
<xslt basedir="test/schematron"
|
61
|
+
style="iso_abstract_expand.xsl" in="test1.sch" out="test2.sch">
|
62
|
+
<classpath>
|
63
|
+
<pathelement location="${lib.dir}/saxon9.jar"/>
|
64
|
+
</classpath>
|
65
|
+
</xslt>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<!-- compile it -->
|
70
|
+
<xslt basedir="test/schematron"
|
71
|
+
style="iso_svrl_for_xslt2.xsl" in="test2.sch" out="test.xsl">
|
72
|
+
<classpath>
|
73
|
+
<pathelement location="${lib.dir}/saxon9.jar"/>
|
74
|
+
</classpath>
|
75
|
+
</xslt>
|
76
|
+
|
77
|
+
<!-- validate -->
|
78
|
+
<xslt basedir="test/schematron"
|
79
|
+
style="test.xsl" in="instance.xml" out="instance.svrlt">
|
80
|
+
<classpath>
|
81
|
+
<pathelement location="${lib.dir}/saxon9.jar"/>
|
82
|
+
</classpath>
|
83
|
+
</xslt>
|
84
|
+
</target>
|