Closed lueck closed 4 years ago
Basically I have no clue, but lets see where we get:
(number (...)) - if ...
or also standalone?schematron
or xslt
instead.Btw. you can remove this from the POM:
<dependency>
<groupId>com.helger.maven</groupId>
<artifactId>ph-schematron-maven-plugin</artifactId>
<version>${ph.schematron.version}</version>
</dependency>
Having it in the
Saxon is fine with the 'if' without parentheses.
I cloned the Schematron/schematron repo and used trunk/schematron/code/iso_svrl_for_xslt2.xsl
to compile a stylesheet from my schematron file using Saxon-HE. Then I applied the resulting stylesheet to my xml sample using Saxon-HE again and the result is as I would expect:
...
<svrl:successful-report test="($level - $preceding-level > 1)" location="/doc[1]/h3[1]">
<svrl:text>Missing headline level: Level 3 follows on level 1</svrl:text>
</svrl:successful-report>
...
I tried Saxon-HE version 10.2 and 9.9.1-7, both successfully.
With the maven plugin I have no success, even when setting schematronProcessingEngine
to schematron
or xslt
.
schXslt also works as expected.
In the test file I created, I also receive this output:
<?xml version="1.0" encoding="UTF-8"?>
<schematron-output xmlns="http://purl.oclc.org/dsdl/svrl" title="" schemaVersion="">
<active-pattern document="C:\dev\git\ph-schematron\ph-schematron\src\test\resources\issues\github108\test.xml" />
<fired-rule context="*[matches(local-name(), '^h\d+$')]" />
<fired-rule context="*[matches(local-name(), '^h\d+$')]" />
<successful-report location="/doc[1]/h3[1]" test="($level - $preceding-level > 1)">
<text>Missing headline level: Level 3 follows on level 1</text>
</successful-report>
<fired-rule context="*[matches(local-name(), '^h\d+$')]" />
<fired-rule context="*[matches(local-name(), '^h\d+$')]" />
<fired-rule context="*[matches(local-name(), '^h\d+$')]" />
</schematron-output>
When using the Maven plugin, please use
<schematronProcessingEngine>schematron</schematronProcessingEngine>
and check the created SVRL
Hm, using schematron
as engine, there are no reports at all. So I conclude, that no test is run.
The fact that the exit code of the maven command is 0, suggests that, too.
Well, after experimenting with the directory layout I can see clearer:
xmlIncludes
there is a report, and the report is as I would expect it to be! Yes!xml/sloppy-doc.xml
.xmlDirectory
was put to xml
.xmlIncludes
to xml/sloppy-doc.xml
would include a file in xml/xml/sloppy-doc.xml
only (tested), but not xml/sloppy-doc.xml
[ERROR] Failed to create parent directory of '/home/clueck/src/scdh/brownbag-coding/xslt-basics/target/schematron-reports/sloppy-doc.xml.svrl'!
So this turned out to be a configuration problem! Sorry taking your time! But thanks for your help!
Thanks for the clarification - that somehow makes sense. Regarding the Maven plugin: I checked and saw, that it only checks for failed asserts but not for successful reports - that was fixed. Also the stupid error message was fixed. I wonder nobody complained about it so far ;-) Building v5.6.4 now
Nice! I've build 5.6.4 locally and it works!
Thanks! Chris
Hi,
I have written the following schematron rule, which works in oXygen:
I use it to find missing headline levels in a flat structure like in the following xml, where
h3
follows onh1
:Using the
ph-schematron-maven-plugin
I get the following error:To me, it seem that after expanding the expression from the second let-binding (i.e.
$preceding-level
) in the test-expression, the syntax tree is not parsed correctly.If I put parentheses around the
if
from the let-binding,value="(if ... else 0)"
, the error disappears. But then the rule is apparently not run, since there is no message that the validation has failed. This seems to be #88, then.Here is my
pom.xml
:I have tried different versions from the latest back to 4.0.8. Neither
pure
, norschematron
norxslt
works as I would expect.Regards, Chris