Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom parameters in ANT Task #62

Closed
phax opened this issue Feb 14, 2018 · 8 comments
Closed

Custom parameters in ANT Task #62

phax opened this issue Feb 14, 2018 · 8 comments

Comments

@phax
Copy link
Owner

phax commented Feb 14, 2018

I'm sure the resolution of #61 should be available in the ANT task as well.
So custom parameters should be made customizable.

@phax
Copy link
Owner Author

phax commented Aug 21, 2018

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 and sch.
    • 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" />

@phax phax added this to the v5.0.6 milestone Aug 21, 2018
@fviolette
Copy link

fviolette commented Nov 18, 2018

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.

@phax
Copy link
Owner Author

phax commented Nov 22, 2018

@fviolette you are correct - it is <parameter> - I will update the text above.
Can you provide the relevant parts from the XML please?

@fviolette
Copy link

Do you mean the ANT part of the sample causing the error I reported?

@phax
Copy link
Owner Author

phax commented Nov 22, 2018

Yes please

@phax
Copy link
Owner Author

phax commented Nov 22, 2018

And the schematron code that causes the error when being parsed. I interpret this as a generic XML error in the Schematron

@fviolette
Copy link

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 &lt;mapref&gt; instead of &lt;topicref format="ditamap"/&gt;.
            </sch:report>
            <sqf:fix id="topicref-to-mapref" role="replace">
                <sqf:description>
                    <sqf:title>Replace &lt;topicref&gt; by &lt;mapref&gt; 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.

@phax phax removed this from the v5.0.6 milestone Apr 24, 2019
@phax
Copy link
Owner Author

phax commented Jun 13, 2019

That was fixed in 5.0.10 with the improved handling of non-Schematron parts

@phax phax closed this as completed Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants