-
Notifications
You must be signed in to change notification settings - Fork 36
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
Abstract patterns support (needs Schematron rewriting?) #48
Comments
When using pure mode, this is correctly handled. I think this is related to Schematron/schematron#6 - right? |
As a workaround, I could suggest to first manually pre-process the pattern with the "pure" component. This leads to the following Schematron: <?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<pattern id="requiredAttribute">
<rule context="Customer">
<assert test="string-length(@type) > 0">
The <name /> element should have a
<value-of select="@type/name()" /> attribute.
</assert>
</rule>
</pattern>
</schema> and when applied with XSLT the output is: <?xml version="1.0" encoding="UTF-8"?>
<schematron-output xmlns="http://purl.oclc.org/dsdl/svrl" title="" schemaVersion="">
<active-pattern id="requiredAttribute" name="requiredAttribute" document=""></active-pattern>
<fired-rule context="Customer"></fired-rule>
<fired-rule context="Customer"></fired-rule>
<failed-assert location="/file[1]/Customer[2]" test="string-length(@type) > 0">
<text>
The Customer element should have a
attribute.
</text>
</failed-assert>
</schematron-output> |
Duly noted. |
As you are working with ANT I suggest I add a new "SchematronPreprocess" task that takes a file and writes a file? |
It's not. I am still struggling with some of my content though so maybe some other +1 would be useful. If you feel like going ahead, I am not going to say no :-) |
Here you go - any feedback is welcome :) |
First attempt with above samples:
|
Can you elaborate on the inckude please. I cant find it in above samples. Thx |
Me neither :-| I pointed to a file which didn't exist - plain and simple. So, maybe we can make the log clearer about that. It does work and I can easily chain it to the previous build. |
On inspecting the preprocessed file, it tells me about the following error for
In my case, I would not object to Authors benefit from the live Schematron validation setup in the editor, and now with ph-schematron, we will run the validation on our full documentation set once in a while and possibly fully integrate this to our build pipeline with org.doctales.schematron after #50 and some more curation of the DITA content. So, except for the first case, fixes are not needed. |
I think <sch:pattern>
<sch:rule>
<sch:report test=""/>
<!-- should go after <report>/<assert> -->
<sqf:fix id=""/>
</sch:rule>
</sch:pattern> |
Of course. I meant the This sample...
...is preprocessed:
(Assert => error in the output preprocessed file:
(Fix => warning in the output preprocessed file: |
The foreign elements are "optimized" away. I opened issue #51 for this. In your case, did you add the |
Yes, indeed. |
I assume this can be closed, as #51 is what is left. Any objections? |
None. Thanks again! |
Hello,
A couple of issues with abstract patterns and
schematronProcessingEngine="schematron"
.The lib is working for me but I currently have many patterns and rules written in the way detailed below.
Versions tested:
ph-schematron-ant-task-4.3.4-jar-with-dependencies.jar
ph-schematron-ant-task-5.0.0-20170807.123330-8-jar-with-dependencies.jar
Example from the ISO Schematron spec repurposed a bit.
schematron.sch
topic.xml
Log
The text was updated successfully, but these errors were encountered: