-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathiso-schematron-svrl-compile-xslt2.xml
110 lines (98 loc) · 4.51 KB
/
iso-schematron-svrl-compile-xslt2.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<project
name="ant-hology.taskdefs.iso-schematron-svrl-compile-xslt2"
basedir="."
xmlns:if="ant:if"
xmlns:unless="ant:unless"
>
<dirname property="ant-hology.taskdefs.iso-schematron-svrl-compile-xslt2.dir" file="${ant.file.ant-hology.taskdefs.iso-schematron-svrl-compile-xslt2}"/>
<import file="${ant-hology.dir}/commonProperties.xml" unless:set="ant-hology.commonProperties.loaded"/>
<import file="${ant-hology.taskdefs.dir}/test.areAllAvailable.xml" unless:set="ant-hology.taskdefs.test.areAllAvailable.loaded"/>
<import file="${ant-hology.taskdefs.dir}/task-saxonb.xml" unless:set="ant-hology.taskdefs.task-saxonb.loaded"/>
<import file="${ant-hology.taskdefs.dir}/property.set.fileName.xml" unless:set="ant-hology.taskdefs.property.set.fileName.loaded"/>
<import file="${ant-hology.pathdefs.dir}/iso-schematron-xslt2.xml" unless:set="ant-hology.pathdefs.iso-schematron-xslt2.loaded"/>
<areAllAvailable
property="ant-hology.availableLibraries.iso-schematron-xslt2"
pathRefId="iso-schematron-xslt2.required"
/>
<!-- See https://code.google.com/p/schematron/#ISO_Schematron -->
<!-- See http://webcache.googleusercontent.com/search?q=cache:http://www.topologi.com/resources/schtrn_xsd_paper.html -->
<macrodef
name="iso-schematron-svrl-compile-xslt2"
description="iso-schematron svrl reporter compiler for XSLT2"
if:set="ant-hology.availableLibraries.iso-schematron-xslt2"
>
<attribute
name="sch"
description="Path to the iso-schematron schema file"
/>
<attribute
name="destXSL"
description="Path to the desitination XSL"
/>
<!--Note: @{parameters} is only used for compiling phase (not include/expand-->
<attribute
name="parameters"
description="Parameters for saxonb when compiling schematron schema. For example, stylesheet parameters could be passed."
default=""/>
<sequential>
<echo>Compiling ISO-Schematron SVRL reporter for schema: @{sch}</echo>
<delete file="@{destXSL}"/>
<mkdir dir="${ant-hology.temp.dir}/schematron"/>
<!--Extract _schFileName-->
<local name="_schPath"/>
<property name="_schPath" location="@{sch}"/>
<local name="_schFileName"/>
<property.set.fileName property="_schFileName" filepath="${_schPath}"/>
<!--Delete existing temp files if they exist-->
<local name="_tempfilesexist"/>
<delete>
<resources>
<file file="${ant-hology.temp.dir}/schematron/${_schFileName}.expandedinclusions"/>
<file file="${ant-hology.temp.dir}/schematron/${_schFileName}.expandedabstractpatterns"/>
</resources>
</delete>
<!--Note: Saxonb is used in case special extensions are desired in future.-->
<echo message="ISO-Schematron SVRL Reporter: Expanding inclusions"/>
<saxonb
xsl="${ant-hology.lib.dir}/iso-schematron-xslt2/iso_dsdl_include.xsl"
srcfile="@{sch}"
destfile="${ant-hology.temp.dir}/schematron/${_schFileName}.expandedinclusions"
/>
<echo message="ISO-Schematron SVRL Reporter: Expanding abstract patterns"/>
<saxonb
xsl="${ant-hology.lib.dir}/iso-schematron-xslt2/iso_abstract_expand.xsl"
srcfile="${ant-hology.temp.dir}/schematron/${_schFileName}.expandedinclusions"
destfile="${ant-hology.temp.dir}/schematron/${_schFileName}.expandedabstractpatterns"
/>
<echo message="ISO-Schematron SVRL Reporter: Compiling"/>
<saxonb
xsl="${ant-hology.lib.dir}/iso-schematron-xslt2/iso_svrl_for_xslt2.xsl"
srcfile="${ant-hology.temp.dir}/schematron/${_schFileName}.expandedabstractpatterns"
destfile="@{destXSL}"
parameters="@{parameters}"
/>
<!--Delete temporary files-->
<delete>
<resources>
<file file="${ant-hology.temp.dir}/schematron/${_schFileName}.expandedinclusions"/>
<file file="${ant-hology.temp.dir}/schematron/${_schFileName}.expandedabstractpatterns"/>
</resources>
</delete>
<local name="_destXSLExists"/>
<available
property="_destXSLExists"
file="@{destXSL}"
/>
<echo
if:set="_destXSLExists"
message="Success: Compiled ISO-Schematron SVRL reporter: @{destXSL}"
/>
<fail
unless:set="_destXSLExists"
message="Error: Compiling ISO-Schematron SVRL reporter failed."
/>
</sequential>
</macrodef>
<property name="ant-hology.taskdefs.iso-schematron-svrl-compile-xslt2.loaded" value="true"/>
</project>