Skip to content

Commit

Permalink
Schematron now being extracted from ODDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
martindholmes committed Aug 8, 2018
1 parent 455f8df commit cf95f03
Showing 1 changed file with 41 additions and 16 deletions.
57 changes: 41 additions & 16 deletions Test2/build_odd.xml
Expand Up @@ -28,8 +28,12 @@
<target name="oddFilesToRng">
<description>
TARGET oddFilesToRng
Converts ODD files to RNG, extracts their contents.xml, diffs
them against expected results.
Converts ODD files to RNG and diffs them against expected results.
Then if correctly-named exemplar files exist, these are validated
against the RNG file and results checked.
Then Schematron is extracted from both the ODD file and the RNG
file, and exemplar files are validated against both Schematron files
with results checked.
</description>

<foreach target="oddFileToRng" param="inFile">
Expand Down Expand Up @@ -74,7 +78,12 @@
<target name="oddFileToRng">
<description>
TARGET oddFileToRng
Converts a single TEI file to rng, then diffs it against expected results.
Converts a sinigle ODD file to RNG and diffs it against expected results.
Then if correctly-named exemplar files exist, these are validated
against the RNG file and results checked.
Then Schematron is extracted from both the ODD file and the RNG
file, and exemplar files are validated against both Schematron files
with results checked.
It takes a single parameter, inFile.
</description>
<basename file="${inFile}" property="plainFileName" suffix=".odd"/>
Expand All @@ -90,19 +99,14 @@
<param name="inFile" value="${outputDir}/${plainFileName}.rng"/>
</antcall>

<!-- We will next need to check whether there are any Schematron
constraints in the file, and if so, export them to create
a separate Schematron file. Checking whether this file exists:
${expectedResultsDir}/${plainFileName}.sch
should signify that there are constraints, and that they should
therefore be exported. Next, the resulting file in
${outputDir}/${plainFileName}.sch
should be diffed against the expected-results file.
<!-- Next we extract Schematron from the ODD file. Rather than
checking first whether there is any Schematron to be extracted,
it's simpler to assume there is (and good practice to include
some anyway). -->
<antcall target="extractSchematronFromOdd">
<param name="inFile" value="${inFile}"/>
</antcall>
<!--
Next:
If there is a file named ${inputDir}/${plainFileName}ValidExemplar.xml, then:
Expand Down Expand Up @@ -149,4 +153,25 @@

</target>

<target name="extractSchematronFromOdd">
<description>
TARGET extractSchematronFromOdd
This target uses Stylesheets/odds/extract-isosch.xsl to
extract the Schematron embedded in an ODD file. It takes
a single parameter inFile, the name of the ODD file, and creates
a single Schematron file, outputFiles/[oddFileNameWithoutExtension]FromOdd.sch.
</description>
<basename file="${inFile}" property="plainFileName" suffix=".odd"/>
<property name="schFromOddFile" value="${outputDir}/${plainFileName}FromOdd.sch"/>
<echo message="Extracting Schematron from ${inFile} into ${schFromOddFile}"/>
<java fork="true" classname="net.sf.saxon.Transform" classpath="${saxonJar}" failonerror="true">
<arg value="-s:${inFile}"/>
<arg value="-xsl:${basedir}/../odds/extract-isosch.xsl"/>
<arg value="-o:${schFromOddFile}"/>
<arg value="--suppressXsltNamespaceCheck:on"/>
<arg value="-versionmsg:off"/>
</java>

</target>

</project>

0 comments on commit cf95f03

Please sign in to comment.