Skip to content

Commit 69a9572

Browse files
author
Jelte Jansen
committed
That revert missed some things, should be fixed now
1 parent c303f73 commit 69a9572

7 files changed

Lines changed: 1888 additions & 1938 deletions

convert/iso_abstract_expand.xsl

Lines changed: 37 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,21 @@
66
This is a preprocessor for ISO Schematron, which implements abstract patterns.
77
It also
88
* 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)
9+
schemas, such as when they are embedded in the same NVDL script
10+
* experimentally, allows parameter recognition and substitution inside
11+
text as well as @context, @test, & @select.
12+
1413
1514
This should be used after iso-dsdl-include.xsl and before the skeleton or
1615
meta-stylesheet (e.g. iso-svrl.xsl) . It only requires XSLT 1.
1716
1817
Each kind of inclusion can be turned off (or on) on the command line.
1918
2019
-->
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)
20+
<!--
21+
VERSION INFORMATION
22+
2008-09-18 RJ
23+
* move out param test from iso:schema template to work with XSLT 1. (Noah Fontes)
6224
6325
2008-07-29 RJ
6426
* Create. Pull out as distinct XSL in its own namespace from old iso_pre_pro.xsl
@@ -78,6 +40,29 @@ VERSION INFORMATION
7840
* Original written for old namespace
7941
* http://www.topologi.com/resources/iso-pre-pro.xsl
8042
-->
43+
<!--
44+
LEGAL INFORMATION
45+
46+
Copyright (c) 2000-2008 Rick Jelliffe and Academia Sinica Computing Center, Taiwan
47+
48+
This software is provided 'as-is', without any express or implied warranty.
49+
In no event will the authors be held liable for any damages arising from
50+
the use of this software.
51+
52+
Permission is granted to anyone to use this software for any purpose,
53+
including commercial applications, and to alter it and redistribute it freely,
54+
subject to the following restrictions:
55+
56+
1. The origin of this software must not be misrepresented; you must not claim
57+
that you wrote the original software. If you use this software in a product,
58+
an acknowledgment in the product documentation would be appreciated but is
59+
not required.
60+
61+
2. Altered source versions must be plainly marked as such, and must not be
62+
misrepresented as being the original software.
63+
64+
3. This notice may not be removed or altered from any source distribution.
65+
-->
8166
<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
8267
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8368
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
@@ -100,12 +85,12 @@ VERSION INFORMATION
10085
<!-- Normal processing rules -->
10186
<!-- ================================================================================== -->
10287
<!-- Output only the selected schema -->
103-
<xslt:template match="iso:schema" >
88+
<xslt:template match="iso:schema" >
10489
<xsl:if test="string-length($schema-id) =0 or @id= $schema-id ">
10590
<xslt:copy>
10691
<xslt:copy-of select="@*" />
10792
<xslt:apply-templates mode="iae:go" />
108-
</xslt:copy>
93+
</xslt:copy>
10994
</xsl:if>
11095
</xslt:template>
11196

@@ -150,7 +135,7 @@ VERSION INFORMATION
150135

151136

152137
<!-- Suppress uses of abstract patterns -->
153-
<xslt:template match="iso:pattern[@is-a]" mode="iae:go" >
138+
<xslt:template match="iso:pattern[@is-a]" mode="iae:go" >
154139

155140
<xslt:comment>Start pattern based on abstract <xslt:value-of select="@is-a"/></xslt:comment>
156141

@@ -245,21 +230,20 @@ VERSION INFORMATION
245230
<xslt:template mode="iae:do-pattern" match="*">
246231
<xslt:param name="caller"/>
247232
<xslt:copy>
248-
<xslt:for-each select="@*[name()='test' or name()='context' or name()='select' or name()='path' ]">
233+
<xslt:for-each select="@*[name()='test' or name()='context' or name()='select']">
249234
<xslt:attribute name="{name()}">
250235
<xslt:call-template name="iae:macro-expand">
251236
<xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
252237
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
253238
</xslt:call-template>
254239
</xslt:attribute>
255240
</xslt:for-each>
256-
<xslt:copy-of select="@*[name()!='test'][name()!='context'][name()!='select'][name()!='path']" />
241+
<xslt:copy-of select="@*[name()!='test'][name()!='context'][name()!='select']" />
257242
<xsl:for-each select="node()">
258243
<xsl:choose>
259244
<!-- Experiment: replace macros in text as well, to allow parameterized assertions
260245
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 -->
246+
delimiting -->
263247
<xsl:when test="self::text()">
264248
<xslt:call-template name="iae:macro-expand">
265249
<xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>

0 commit comments

Comments
 (0)