phax / ph-schematron

Java Schematron library that supports XSLT and native application
Apache License 2.0
115 stars 36 forks source link

XSLT different than pure #104

Closed thammr closed 3 years ago

thammr commented 4 years ago

Hi

I am experimenting with using Schematron to perform some XML validation that appears impossible using XSD constraints. Initially I used Jing with eXist-db. That worked but provided no usable error locations (line="-1" column="-1"). I then tried Ph-Schematron 5.6 with Java.

Using XSLT, I get the correct response (1 assert failure from 1st rule). Using pure, I get heaps of bogus assert failures from both rules.

Schematron

test.txt

Pure seems to be ignoring [@id=$propname] in both rules as I get the same result when I remove them. The [@id=$subname] in the first rule => count($definition) = 0. If I remove it, count($definitions) = total number of property definitions. It seems that [@id=$subname] & [@id=$propname] are not working as I expect with pure.

Am I doing something wrong?

Java code

java.txt

Example file

data.txt

I hope I have attached the schematron, java and xml properly.

thammr commented 4 years ago

The location attribute of failed-assert apparently uses zero-based indexing for Pure and one-based indexing for XSLT. My understanding is that xpath requires one-based indexing.

phax commented 4 years ago

Yes I figured that "pure" creates more problems than it solves. And I think I will kick it (or at least move it to a separate artefact). There is another open issue (#88) that would also require me to make a whole bunch of changes. That's why I will most likely make a strategic rewrite for v6 so that you are not eventually kept in the trap of "Pure" Schematron ;-)

thammr commented 4 years ago

No worries mate, XSLT works very well for me.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

phax commented 3 years ago

Closing this, as it works.