lxml 6.0.0__cp313-cp313-manylinux_2_31_armv7l.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.
Files changed (174) hide show
  1. lxml/ElementInclude.py +244 -0
  2. lxml/__init__.py +22 -0
  3. lxml/_elementpath.cpython-313-arm-linux-gnueabihf.so +0 -0
  4. lxml/_elementpath.py +343 -0
  5. lxml/apihelpers.pxi +1801 -0
  6. lxml/builder.cpython-313-arm-linux-gnueabihf.so +0 -0
  7. lxml/builder.py +243 -0
  8. lxml/classlookup.pxi +580 -0
  9. lxml/cleanup.pxi +215 -0
  10. lxml/cssselect.py +101 -0
  11. lxml/debug.pxi +36 -0
  12. lxml/docloader.pxi +178 -0
  13. lxml/doctestcompare.py +488 -0
  14. lxml/dtd.pxi +479 -0
  15. lxml/etree.cpython-313-arm-linux-gnueabihf.so +0 -0
  16. lxml/etree.h +244 -0
  17. lxml/etree.pyx +3853 -0
  18. lxml/etree_api.h +204 -0
  19. lxml/extensions.pxi +830 -0
  20. lxml/html/ElementSoup.py +10 -0
  21. lxml/html/__init__.py +1927 -0
  22. lxml/html/_diffcommand.py +86 -0
  23. lxml/html/_difflib.cpython-313-arm-linux-gnueabihf.so +0 -0
  24. lxml/html/_difflib.py +2106 -0
  25. lxml/html/_html5builder.py +100 -0
  26. lxml/html/_setmixin.py +56 -0
  27. lxml/html/builder.py +173 -0
  28. lxml/html/clean.py +21 -0
  29. lxml/html/defs.py +135 -0
  30. lxml/html/diff.cpython-313-arm-linux-gnueabihf.so +0 -0
  31. lxml/html/diff.py +972 -0
  32. lxml/html/formfill.py +299 -0
  33. lxml/html/html5parser.py +260 -0
  34. lxml/html/soupparser.py +314 -0
  35. lxml/html/usedoctest.py +13 -0
  36. lxml/includes/__init__.pxd +0 -0
  37. lxml/includes/__init__.py +0 -0
  38. lxml/includes/c14n.pxd +25 -0
  39. lxml/includes/config.pxd +3 -0
  40. lxml/includes/dtdvalid.pxd +18 -0
  41. lxml/includes/etree_defs.h +379 -0
  42. lxml/includes/etreepublic.pxd +237 -0
  43. lxml/includes/extlibs/__init__.py +0 -0
  44. lxml/includes/extlibs/libcharset.h +45 -0
  45. lxml/includes/extlibs/localcharset.h +137 -0
  46. lxml/includes/extlibs/zconf.h +543 -0
  47. lxml/includes/extlibs/zlib.h +1938 -0
  48. lxml/includes/htmlparser.pxd +56 -0
  49. lxml/includes/libexslt/__init__.py +0 -0
  50. lxml/includes/libexslt/exslt.h +108 -0
  51. lxml/includes/libexslt/exsltconfig.h +70 -0
  52. lxml/includes/libexslt/exsltexports.h +63 -0
  53. lxml/includes/libxml/HTMLparser.h +339 -0
  54. lxml/includes/libxml/HTMLtree.h +148 -0
  55. lxml/includes/libxml/SAX.h +18 -0
  56. lxml/includes/libxml/SAX2.h +170 -0
  57. lxml/includes/libxml/__init__.py +0 -0
  58. lxml/includes/libxml/c14n.h +115 -0
  59. lxml/includes/libxml/catalog.h +183 -0
  60. lxml/includes/libxml/chvalid.h +230 -0
  61. lxml/includes/libxml/debugXML.h +79 -0
  62. lxml/includes/libxml/dict.h +82 -0
  63. lxml/includes/libxml/encoding.h +307 -0
  64. lxml/includes/libxml/entities.h +147 -0
  65. lxml/includes/libxml/globals.h +25 -0
  66. lxml/includes/libxml/hash.h +251 -0
  67. lxml/includes/libxml/list.h +137 -0
  68. lxml/includes/libxml/nanoftp.h +16 -0
  69. lxml/includes/libxml/nanohttp.h +98 -0
  70. lxml/includes/libxml/parser.h +1633 -0
  71. lxml/includes/libxml/parserInternals.h +591 -0
  72. lxml/includes/libxml/relaxng.h +224 -0
  73. lxml/includes/libxml/schemasInternals.h +959 -0
  74. lxml/includes/libxml/schematron.h +143 -0
  75. lxml/includes/libxml/threads.h +81 -0
  76. lxml/includes/libxml/tree.h +1326 -0
  77. lxml/includes/libxml/uri.h +106 -0
  78. lxml/includes/libxml/valid.h +485 -0
  79. lxml/includes/libxml/xinclude.h +141 -0
  80. lxml/includes/libxml/xlink.h +193 -0
  81. lxml/includes/libxml/xmlIO.h +419 -0
  82. lxml/includes/libxml/xmlautomata.h +163 -0
  83. lxml/includes/libxml/xmlerror.h +962 -0
  84. lxml/includes/libxml/xmlexports.h +96 -0
  85. lxml/includes/libxml/xmlmemory.h +188 -0
  86. lxml/includes/libxml/xmlmodule.h +61 -0
  87. lxml/includes/libxml/xmlreader.h +444 -0
  88. lxml/includes/libxml/xmlregexp.h +116 -0
  89. lxml/includes/libxml/xmlsave.h +111 -0
  90. lxml/includes/libxml/xmlschemas.h +254 -0
  91. lxml/includes/libxml/xmlschemastypes.h +152 -0
  92. lxml/includes/libxml/xmlstring.h +140 -0
  93. lxml/includes/libxml/xmlunicode.h +15 -0
  94. lxml/includes/libxml/xmlversion.h +332 -0
  95. lxml/includes/libxml/xmlwriter.h +489 -0
  96. lxml/includes/libxml/xpath.h +569 -0
  97. lxml/includes/libxml/xpathInternals.h +639 -0
  98. lxml/includes/libxml/xpointer.h +48 -0
  99. lxml/includes/libxslt/__init__.py +0 -0
  100. lxml/includes/libxslt/attributes.h +39 -0
  101. lxml/includes/libxslt/documents.h +93 -0
  102. lxml/includes/libxslt/extensions.h +262 -0
  103. lxml/includes/libxslt/extra.h +72 -0
  104. lxml/includes/libxslt/functions.h +78 -0
  105. lxml/includes/libxslt/imports.h +75 -0
  106. lxml/includes/libxslt/keys.h +53 -0
  107. lxml/includes/libxslt/namespaces.h +68 -0
  108. lxml/includes/libxslt/numbersInternals.h +73 -0
  109. lxml/includes/libxslt/pattern.h +84 -0
  110. lxml/includes/libxslt/preproc.h +43 -0
  111. lxml/includes/libxslt/security.h +104 -0
  112. lxml/includes/libxslt/templates.h +77 -0
  113. lxml/includes/libxslt/transform.h +207 -0
  114. lxml/includes/libxslt/variables.h +118 -0
  115. lxml/includes/libxslt/xslt.h +110 -0
  116. lxml/includes/libxslt/xsltInternals.h +1995 -0
  117. lxml/includes/libxslt/xsltconfig.h +146 -0
  118. lxml/includes/libxslt/xsltexports.h +64 -0
  119. lxml/includes/libxslt/xsltlocale.h +44 -0
  120. lxml/includes/libxslt/xsltutils.h +343 -0
  121. lxml/includes/lxml-version.h +3 -0
  122. lxml/includes/relaxng.pxd +64 -0
  123. lxml/includes/schematron.pxd +34 -0
  124. lxml/includes/tree.pxd +492 -0
  125. lxml/includes/uri.pxd +5 -0
  126. lxml/includes/xinclude.pxd +22 -0
  127. lxml/includes/xmlerror.pxd +852 -0
  128. lxml/includes/xmlparser.pxd +303 -0
  129. lxml/includes/xmlschema.pxd +35 -0
  130. lxml/includes/xpath.pxd +136 -0
  131. lxml/includes/xslt.pxd +190 -0
  132. lxml/isoschematron/__init__.py +348 -0
  133. lxml/isoschematron/resources/rng/iso-schematron.rng +709 -0
  134. lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl +75 -0
  135. lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl +77 -0
  136. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl +313 -0
  137. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl +1160 -0
  138. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl +55 -0
  139. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1796 -0
  140. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +588 -0
  141. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt +84 -0
  142. lxml/iterparse.pxi +438 -0
  143. lxml/lxml.etree.h +244 -0
  144. lxml/lxml.etree_api.h +204 -0
  145. lxml/nsclasses.pxi +281 -0
  146. lxml/objectify.cpython-313-arm-linux-gnueabihf.so +0 -0
  147. lxml/objectify.pyx +2149 -0
  148. lxml/objectpath.pxi +332 -0
  149. lxml/parser.pxi +2059 -0
  150. lxml/parsertarget.pxi +180 -0
  151. lxml/proxy.pxi +619 -0
  152. lxml/public-api.pxi +178 -0
  153. lxml/pyclasslookup.py +3 -0
  154. lxml/readonlytree.pxi +565 -0
  155. lxml/relaxng.pxi +165 -0
  156. lxml/sax.cpython-313-arm-linux-gnueabihf.so +0 -0
  157. lxml/sax.py +286 -0
  158. lxml/saxparser.pxi +875 -0
  159. lxml/schematron.pxi +173 -0
  160. lxml/serializer.pxi +1849 -0
  161. lxml/usedoctest.py +13 -0
  162. lxml/xinclude.pxi +67 -0
  163. lxml/xmlerror.pxi +1654 -0
  164. lxml/xmlid.pxi +179 -0
  165. lxml/xmlschema.pxi +215 -0
  166. lxml/xpath.pxi +487 -0
  167. lxml/xslt.pxi +957 -0
  168. lxml/xsltext.pxi +242 -0
  169. lxml-6.0.0.dist-info/METADATA +163 -0
  170. lxml-6.0.0.dist-info/RECORD +174 -0
  171. lxml-6.0.0.dist-info/WHEEL +5 -0
  172. lxml-6.0.0.dist-info/licenses/LICENSE.txt +31 -0
  173. lxml-6.0.0.dist-info/licenses/LICENSES.txt +29 -0
  174. lxml-6.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,75 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ Stylesheet for extracting Schematron information from a RELAX-NG schema.
4
+ Based on the stylesheet for extracting Schematron information from W3C XML Schema.
5
+ Created by Eddie Robertsson 2002/06/01
6
+ 2009/12/10 hj: changed Schematron namespace to ISO URI (Holger Joukl)
7
+ -->
8
+ <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9
+ xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:rng="http://relaxng.org/ns/structure/1.0">
10
+ <!-- Set the output to be XML with an XML declaration and use indentation -->
11
+ <xsl:output method="xml" omit-xml-declaration="no" indent="yes" standalone="yes"/>
12
+ <!-- -->
13
+ <!-- match schema and call recursive template to extract included schemas -->
14
+ <!-- -->
15
+ <xsl:template match="/rng:grammar | /rng:element">
16
+ <!-- call the schema definition template ... -->
17
+ <xsl:call-template name="gatherSchema">
18
+ <!-- ... with current node as the $schemas parameter ... -->
19
+ <xsl:with-param name="schemas" select="."/>
20
+ <!-- ... and any includes in the $include parameter -->
21
+ <xsl:with-param name="includes" select="document(/rng:grammar/rng:include/@href
22
+ | //rng:externalRef/@href)"/>
23
+ </xsl:call-template>
24
+ </xsl:template>
25
+ <!-- -->
26
+ <!-- gather all included schemas into a single parameter variable -->
27
+ <!-- -->
28
+ <xsl:template name="gatherSchema">
29
+ <xsl:param name="schemas"/>
30
+ <xsl:param name="includes"/>
31
+ <xsl:choose>
32
+ <xsl:when test="count($schemas) &lt; count($schemas | $includes)">
33
+ <!-- when $includes includes something new, recurse ... -->
34
+ <xsl:call-template name="gatherSchema">
35
+ <!-- ... with current $includes added to the $schemas parameter ... -->
36
+ <xsl:with-param name="schemas" select="$schemas | $includes"/>
37
+ <!-- ... and any *new* includes in the $include parameter -->
38
+ <xsl:with-param name="includes" select="document($includes/rng:grammar/rng:include/@href
39
+ | $includes//rng:externalRef/@href)"/>
40
+ </xsl:call-template>
41
+ </xsl:when>
42
+ <xsl:otherwise>
43
+ <!-- we have the complete set of included schemas, so now let's output the embedded schematron -->
44
+ <xsl:call-template name="output">
45
+ <xsl:with-param name="schemas" select="$schemas"/>
46
+ </xsl:call-template>
47
+ </xsl:otherwise>
48
+ </xsl:choose>
49
+ </xsl:template>
50
+ <!-- -->
51
+ <!-- output the schematron information -->
52
+ <!-- -->
53
+ <xsl:template name="output">
54
+ <xsl:param name="schemas"/>
55
+ <!-- -->
56
+ <sch:schema>
57
+ <!-- get header-type elements - eg title and especially ns -->
58
+ <!-- title (just one) -->
59
+ <xsl:copy-of select="$schemas//sch:title[1]"/>
60
+ <!-- get remaining schematron schema children -->
61
+ <!-- get non-blank namespace elements, dropping duplicates -->
62
+ <xsl:for-each select="$schemas//sch:ns">
63
+ <xsl:if test="generate-id(.) = generate-id($schemas//sch:ns[@prefix = current()/@prefix][1])">
64
+ <xsl:copy-of select="."/>
65
+ </xsl:if>
66
+ </xsl:for-each>
67
+ <xsl:copy-of select="$schemas//sch:phase"/>
68
+ <xsl:copy-of select="$schemas//sch:pattern"/>
69
+ <sch:diagnostics>
70
+ <xsl:copy-of select="$schemas//sch:diagnostics/*"/>
71
+ </sch:diagnostics>
72
+ </sch:schema>
73
+ </xsl:template>
74
+ <!-- -->
75
+ </xsl:transform>
@@ -0,0 +1,77 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ based on an original transform by Eddie Robertsson
4
+ 2001/04/21 fn: added support for included schemas
5
+ 2001/06/27 er: changed XMl Schema prefix from xsd: to xs: and changed to the Rec namespace
6
+ 2009/12/10 hj: changed Schematron namespace to ISO URI (Holger Joukl)
7
+ -->
8
+ <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9
+ xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema">
10
+ <!-- Set the output to be XML with an XML declaration and use indentation -->
11
+ <xsl:output method="xml" omit-xml-declaration="no" indent="yes" standalone="yes"/>
12
+ <!-- -->
13
+ <!-- match schema and call recursive template to extract included schemas -->
14
+ <!-- -->
15
+ <xsl:template match="xs:schema">
16
+ <!-- call the schema definition template ... -->
17
+ <xsl:call-template name="gatherSchema">
18
+ <!-- ... with current current root as the $schemas parameter ... -->
19
+ <xsl:with-param name="schemas" select="/"/>
20
+ <!-- ... and any includes in the $include parameter -->
21
+ <xsl:with-param name="includes"
22
+ select="document(/xs:schema/xs:*[self::xs:include or self::xs:import or self::xs:redefine]/@schemaLocation)"/>
23
+ </xsl:call-template>
24
+ </xsl:template>
25
+ <!-- -->
26
+ <!-- gather all included schemas into a single parameter variable -->
27
+ <!-- -->
28
+ <xsl:template name="gatherSchema">
29
+ <xsl:param name="schemas"/>
30
+ <xsl:param name="includes"/>
31
+ <xsl:choose>
32
+ <xsl:when test="count($schemas) &lt; count($schemas | $includes)">
33
+ <!-- when $includes includes something new, recurse ... -->
34
+ <xsl:call-template name="gatherSchema">
35
+ <!-- ... with current $includes added to the $schemas parameter ... -->
36
+ <xsl:with-param name="schemas" select="$schemas | $includes"/>
37
+ <!-- ... and any *new* includes in the $include parameter -->
38
+ <xsl:with-param name="includes"
39
+ select="document($includes/xs:schema/xs:*[self::xs:include or self::xs:import or self::xs:redefine]/@schemaLocation)"/>
40
+ </xsl:call-template>
41
+ </xsl:when>
42
+ <xsl:otherwise>
43
+ <!-- we have the complete set of included schemas,
44
+ so now let's output the embedded schematron -->
45
+ <xsl:call-template name="output">
46
+ <xsl:with-param name="schemas" select="$schemas"/>
47
+ </xsl:call-template>
48
+ </xsl:otherwise>
49
+ </xsl:choose>
50
+ </xsl:template>
51
+ <!-- -->
52
+ <!-- output the schematron information -->
53
+ <!-- -->
54
+ <xsl:template name="output">
55
+ <xsl:param name="schemas"/>
56
+ <!-- -->
57
+ <sch:schema>
58
+ <!-- get header-type elements - eg title and especially ns -->
59
+ <!-- title (just one) -->
60
+ <xsl:copy-of select="$schemas//xs:appinfo/sch:title[1]"/>
61
+ <!-- get remaining schematron schema children -->
62
+ <!-- get non-blank namespace elements, dropping duplicates -->
63
+ <xsl:for-each select="$schemas//xs:appinfo/sch:ns">
64
+ <xsl:if test="generate-id(.) =
65
+ generate-id($schemas//xs:appinfo/sch:ns[@prefix = current()/@prefix][1])">
66
+ <xsl:copy-of select="."/>
67
+ </xsl:if>
68
+ </xsl:for-each>
69
+ <xsl:copy-of select="$schemas//xs:appinfo/sch:phase"/>
70
+ <xsl:copy-of select="$schemas//xs:appinfo/sch:pattern"/>
71
+ <sch:diagnostics>
72
+ <xsl:copy-of select="$schemas//xs:appinfo/sch:diagnostics/*"/>
73
+ </sch:diagnostics>
74
+ </sch:schema>
75
+ </xsl:template>
76
+ <!-- -->
77
+ </xsl:transform>
@@ -0,0 +1,313 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><?xar XSLT?>
2
+
3
+ <!--
4
+ OVERVIEW - iso_abstract_expand.xsl
5
+
6
+ This is a preprocessor for ISO Schematron, which implements abstract patterns.
7
+ It also
8
+ * extracts a particular schema using an ID, where there are multiple
9
+ schemas, such as when they are embedded in the same NVDL script
10
+ * allows parameter substitution inside @context, @test, @select, @path
11
+ * experimentally, allows parameter recognition and substitution inside
12
+ text (NOTE: to be removed, for compataibility with other implementations,
13
+ please do not use this)
14
+
15
+ This should be used after iso-dsdl-include.xsl and before the skeleton or
16
+ meta-stylesheet (e.g. iso-svrl.xsl) . It only requires XSLT 1.
17
+
18
+ Each kind of inclusion can be turned off (or on) on the command line.
19
+
20
+ -->
21
+
22
+ <!--
23
+ Open Source Initiative OSI - The MIT License:Licensing
24
+ [OSI Approved License]
25
+
26
+ This source code was previously available under the zlib/libpng license.
27
+ Attribution is polite.
28
+
29
+ The MIT License
30
+
31
+ Copyright (c) 2004-2010 Rick Jellife and Academia Sinica Computing Centre, Taiwan
32
+
33
+ Permission is hereby granted, free of charge, to any person obtaining a copy
34
+ of this software and associated documentation files (the "Software"), to deal
35
+ in the Software without restriction, including without limitation the rights
36
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37
+ copies of the Software, and to permit persons to whom the Software is
38
+ furnished to do so, subject to the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be included in
41
+ all copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
49
+ THE SOFTWARE.
50
+ -->
51
+
52
+ <!--
53
+ VERSION INFORMATION
54
+ 2013-09-19 RJ
55
+ * Allow macro expansion in @path attributes, eg. for sch:name/@path
56
+
57
+ 2010-07-10 RJ
58
+ * Move to MIT license
59
+
60
+ 2008-09-18 RJ
61
+ * move out param test from iso:schema template to work with XSLT 1. (Noah Fontes)
62
+
63
+ 2008-07-29 RJ
64
+ * Create. Pull out as distinct XSL in its own namespace from old iso_pre_pro.xsl
65
+ * Put everything in private namespace
66
+ * Rewrite replace_substring named template so that copyright is clear
67
+
68
+ 2008-07-24 RJ
69
+ * correct abstract patterns so for correct names: param/@name and
70
+ param/@value
71
+
72
+ 2007-01-12 RJ
73
+ * Use ISO namespace
74
+ * Use pattern/@id not pattern/@name
75
+ * Add Oliver Becker's suggests from old Schematron-love-in list for <copy>
76
+ * Add XT -ism?
77
+ 2003 RJ
78
+ * Original written for old namespace
79
+ * http://www.topologi.com/resources/iso-pre-pro.xsl
80
+ -->
81
+ <xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
82
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
83
+ xmlns:iso="http://purl.oclc.org/dsdl/schematron"
84
+ xmlns:nvdl="http://purl.oclc.org/dsdl/nvdl"
85
+
86
+ xmlns:iae="http://www.schematron.com/namespace/iae"
87
+
88
+ >
89
+
90
+ <xslt:param name="schema-id"></xslt:param>
91
+
92
+
93
+ <!-- Driver for the mode -->
94
+ <xsl:template match="/">
95
+ <xsl:apply-templates select="." mode="iae:go" />
96
+ </xsl:template>
97
+
98
+
99
+ <!-- ================================================================================== -->
100
+ <!-- Normal processing rules -->
101
+ <!-- ================================================================================== -->
102
+ <!-- Output only the selected schema -->
103
+ <xslt:template match="iso:schema" >
104
+ <xsl:if test="string-length($schema-id) =0 or @id= $schema-id ">
105
+ <xslt:copy>
106
+ <xslt:copy-of select="@*" />
107
+ <xslt:apply-templates mode="iae:go" />
108
+ </xslt:copy>
109
+ </xsl:if>
110
+ </xslt:template>
111
+
112
+
113
+ <!-- Strip out any foreign elements above the Schematron schema .
114
+ -->
115
+ <xslt:template match="*[not(ancestor-or-self::iso:*)]" mode="iae:go" >
116
+ <xslt:apply-templates mode="iae:go" />
117
+ </xslt:template>
118
+
119
+
120
+ <!-- ================================================================================== -->
121
+ <!-- Handle Schematron abstract pattern preprocessing -->
122
+ <!-- abstract-to-real calls
123
+ do-pattern calls
124
+ macro-expand calls
125
+ multi-macro-expand
126
+ replace-substring -->
127
+ <!-- ================================================================================== -->
128
+
129
+ <!--
130
+ Abstract patterns allow you to say, for example
131
+
132
+ <pattern name="htmlTable" is-a="table">
133
+ <param name="row" value="html:tr"/>
134
+ <param name="cell" value="html:td" />
135
+ <param name="table" value="html:table" />
136
+ </pattern>
137
+
138
+ For a good introduction, see Uche Ogbujii's article for IBM DeveloperWorks
139
+ "Discover the flexibility of Schematron abstract patterns"
140
+ http://www-128.ibm.com/developerworks/xml/library/x-stron.html
141
+ However, note that ISO Schematron uses @name and @value attributes on
142
+ the iso:param element, and @id not @name on the pattern element.
143
+
144
+ -->
145
+
146
+ <!-- Suppress declarations of abstract patterns -->
147
+ <xslt:template match="iso:pattern[@abstract='true']" mode="iae:go" >
148
+ <xslt:comment>Suppressed abstract pattern <xslt:value-of select="@id"/> was here</xslt:comment>
149
+ </xslt:template>
150
+
151
+
152
+ <!-- Suppress uses of abstract patterns -->
153
+ <xslt:template match="iso:pattern[@is-a]" mode="iae:go" >
154
+
155
+ <xslt:comment>Start pattern based on abstract <xslt:value-of select="@is-a"/></xslt:comment>
156
+
157
+ <xslt:call-template name="iae:abstract-to-real" >
158
+ <xslt:with-param name="caller" select="@id" />
159
+ <xslt:with-param name="is-a" select="@is-a" />
160
+ </xslt:call-template>
161
+
162
+ </xslt:template>
163
+
164
+
165
+
166
+ <!-- output everything else unchanged -->
167
+ <xslt:template match="*" priority="-1" mode="iae:go" >
168
+ <xslt:copy>
169
+ <xslt:copy-of select="@*" />
170
+ <xslt:apply-templates mode="iae:go"/>
171
+ </xslt:copy>
172
+ </xslt:template>
173
+
174
+ <!-- Templates for macro expansion of abstract patterns -->
175
+ <!-- Sets up the initial conditions for the recursive call -->
176
+ <xslt:template name="iae:macro-expand">
177
+ <xslt:param name="caller"/>
178
+ <xslt:param name="text" />
179
+ <xslt:call-template name="iae:multi-macro-expand">
180
+ <xslt:with-param name="caller" select="$caller"/>
181
+ <xslt:with-param name="text" select="$text"/>
182
+ <xslt:with-param name="paramNumber" select="1"/>
183
+ </xslt:call-template>
184
+
185
+ </xslt:template>
186
+
187
+ <!-- Template to replace the current parameter and then
188
+ recurse to replace subsequent parameters. -->
189
+
190
+ <xslt:template name="iae:multi-macro-expand">
191
+ <xslt:param name="caller"/>
192
+ <xslt:param name="text" />
193
+ <xslt:param name="paramNumber" />
194
+
195
+
196
+ <xslt:choose>
197
+ <xslt:when test="//iso:pattern[@id=$caller]/iso:param[ $paramNumber]">
198
+
199
+ <xslt:call-template name="iae:multi-macro-expand">
200
+ <xslt:with-param name="caller" select="$caller"/>
201
+ <xslt:with-param name="paramNumber" select="$paramNumber + 1"/>
202
+ <xslt:with-param name="text" >
203
+ <xslt:call-template name="iae:replace-substring">
204
+ <xslt:with-param name="original" select="$text"/>
205
+ <xslt:with-param name="substring"
206
+ select="concat('$', //iso:pattern[@id=$caller]/iso:param[ $paramNumber ]/@name)"/>
207
+ <xslt:with-param name="replacement"
208
+ select="//iso:pattern[@id=$caller]/iso:param[ $paramNumber ]/@value"/>
209
+ </xslt:call-template>
210
+ </xslt:with-param>
211
+ </xslt:call-template>
212
+ </xslt:when>
213
+ <xslt:otherwise><xslt:value-of select="$text" /></xslt:otherwise>
214
+
215
+ </xslt:choose>
216
+ </xslt:template>
217
+
218
+
219
+ <!-- generate the real pattern from an abstract pattern + parameters-->
220
+ <xslt:template name="iae:abstract-to-real" >
221
+ <xslt:param name="caller"/>
222
+ <xslt:param name="is-a" />
223
+ <xslt:for-each select="//iso:pattern[@id= $is-a]">
224
+ <xslt:copy>
225
+
226
+ <xslt:choose>
227
+ <xslt:when test=" string-length( $caller ) = 0">
228
+ <xslt:attribute name="id"><xslt:value-of select="concat( generate-id(.) , $is-a)" /></xslt:attribute>
229
+ </xslt:when>
230
+ <xslt:otherwise>
231
+ <xslt:attribute name="id"><xslt:value-of select="$caller" /></xslt:attribute>
232
+ </xslt:otherwise>
233
+ </xslt:choose>
234
+
235
+ <xslt:apply-templates select="*|text()" mode="iae:do-pattern" >
236
+ <xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
237
+ </xslt:apply-templates>
238
+
239
+ </xslt:copy>
240
+ </xslt:for-each>
241
+ </xslt:template>
242
+
243
+
244
+ <!-- Generate a non-abstract pattern -->
245
+ <xslt:template mode="iae:do-pattern" match="*">
246
+ <xslt:param name="caller"/>
247
+ <xslt:copy>
248
+ <xslt:for-each select="@*[name()='test' or name()='context' or name()='select' or name()='path' ]">
249
+ <xslt:attribute name="{name()}">
250
+ <xslt:call-template name="iae:macro-expand">
251
+ <xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
252
+ <xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
253
+ </xslt:call-template>
254
+ </xslt:attribute>
255
+ </xslt:for-each>
256
+ <xslt:copy-of select="@*[name()!='test'][name()!='context'][name()!='select'][name()!='path']" />
257
+ <xsl:for-each select="node()">
258
+ <xsl:choose>
259
+ <!-- Experiment: replace macros in text as well, to allow parameterized assertions
260
+ and so on, without having to have spurious <iso:value-of> calls and multiple
261
+ delimiting.
262
+ NOTE: THIS FUNCTIONALITY WILL BE REMOVED IN THE FUTURE -->
263
+ <xsl:when test="self::text()">
264
+ <xslt:call-template name="iae:macro-expand">
265
+ <xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
266
+ <xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
267
+ </xslt:call-template>
268
+ </xsl:when>
269
+ <xsl:otherwise>
270
+ <xslt:apply-templates select="." mode="iae:do-pattern">
271
+ <xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
272
+ </xslt:apply-templates>
273
+ </xsl:otherwise>
274
+ </xsl:choose>
275
+ </xsl:for-each>
276
+ </xslt:copy>
277
+ </xslt:template>
278
+
279
+ <!-- UTILITIES -->
280
+ <!-- Simple version of replace-substring function -->
281
+ <xslt:template name="iae:replace-substring">
282
+ <xslt:param name="original" />
283
+ <xslt:param name="substring" />
284
+ <xslt:param name="replacement" select="''"/>
285
+
286
+ <xsl:choose>
287
+ <xsl:when test="not($original)" />
288
+ <xsl:when test="not(string($substring))">
289
+ <xsl:value-of select="$original" />
290
+ </xsl:when>
291
+ <xsl:when test="contains($original, $substring)">
292
+ <xsl:variable name="before" select="substring-before($original, $substring)" />
293
+ <xsl:variable name="after" select="substring-after($original, $substring)" />
294
+
295
+ <xsl:value-of select="$before" />
296
+ <xsl:value-of select="$replacement" />
297
+ <!-- recursion -->
298
+ <xsl:call-template name="iae:replace-substring">
299
+ <xsl:with-param name="original" select="$after" />
300
+ <xsl:with-param name="substring" select="$substring" />
301
+ <xsl:with-param name="replacement" select="$replacement" />
302
+ </xsl:call-template>
303
+ </xsl:when>
304
+ <xsl:otherwise>
305
+ <!-- no substitution -->
306
+ <xsl:value-of select="$original" />
307
+ </xsl:otherwise>
308
+ </xsl:choose>
309
+ </xslt:template>
310
+
311
+
312
+
313
+ </xslt:stylesheet>