Custom parameters in ANT Task
phax opened this issue · 8 comments
I'm sure the resolution of #61 should be available in the ANT task as well.
So custom parameters should be made customizable.
The latest SNAPSHOT (-3) from https://oss.sonatype.org/content/repositories/snapshots/com/helger/ph-schematron/5.0.6-SNAPSHOT/ contains support for parameters. Docs:
<parameter>
(since v5.0.6)- The usage of the element is optional.
- The element is only interpreted for the processing engines
xslt
andsch
. - The attribute 'name' defines the custom attribute name.
- The attribute 'value' defines the custom attribute value. If the value is omitted, an empty String is passed instead.
Example (multiplicity 0-n):
<parameter name="allow-foreign" value="true" />
This seems to work with <parameter>
within ANT tasks as well, but not with <attribute>
.
However, with allow-foreign set to true, while the initial noise log about sqf:fix or xsl:template is no longer displayed, I get this further down, and actual errors are no longer reported:
[schematron] 00:03:50.327 [main] ERROR com.helger.jaxb.GenericJAXBMarshaller - Failed to parse XML document: cvc-complex-type.2.4.a: Invalid content was found starting with element 'sqf:fix'. One of '{"http://purl.oclc.org/dsdl/svrl":active-pattern, "http://purl.oclc.org/dsdl/svrl":fired-rule, "http://purl.oclc.org/dsdl/svrl":failed-assert, "http://purl.oclc.org/dsdl/svrl":successful-report}' is expected.
@fviolette you are correct - it is <parameter>
- I will update the text above.
Can you provide the relevant parts from the XML please?
Do you mean the ANT part of the sample causing the error I reported?
Yes please
And the schematron code that causes the error when being parsed. I interpret this as a generic XML error in the Schematron
Setup is:
- ph-schematron version: 5.0.6 with fat ANT jar (no error in 5.0.5)
- schematronProcessingEngine="schematron"
- <parameter name="allow-foreign" value="true"> (same behaviour with or without this parameter)
One of several use cases that give an error — another would be sqf:user-entry.
map.ditamap
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map xml:lang="en-US" id="map">
<title>Test map</title>
<topicref href="submap.ditamap"/>
</map>
rules.sch
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<sch:pattern id="topicref-ditamap">
<sch:rule context="topicref">
<sch:report test="contains(@href, 'ditamap')" role="info" sqf:fix="topicref-to-mapref">
Use <mapref> instead of <topicref format="ditamap"/>.
</sch:report>
<sqf:fix id="topicref-to-mapref" role="replace">
<sqf:description>
<sqf:title>Replace <topicref> by <mapref> elements.</sqf:title>
</sqf:description>
<sqf:replace match="//topicref[contains(@href, 'ditamap')]"
node-type="element" target='mapref href="{@href}"'/>
</sqf:fix>
</sch:rule>
</sch:pattern>
</sch:schema>
This gives:
ERROR com.helger.jaxb.GenericJAXBMarshaller - Failed to parse XML document: cvc-complex-type.2.4.a: Invalid content was found starting with element 'sqf:fix'. One of '{"http://purl.oclc.org/dsdl/svrl":active-pattern, "http://purl.oclc.org/dsdl/svrl":fired-rule, "http://purl.oclc.org/dsdl/svrl":failed-assert, "http://purl.oclc.org/dsdl/svrl":successful-report}' is expected.
That was fixed in 5.0.10 with the improved handling of non-Schematron parts