XPath 2.0 in Schematron

Oxygen general issues.
dsewell
Posts: 125
Joined: Mon Jun 09, 2003 6:02 pm
Location: Charlottesville, Virginia USA

XPath 2.0 in Schematron

Post by dsewell »

How does oXygen 7 implement its use of XPath 2.0 syntax in a Schematron schema? It is working perfectly, but if I try using Jing externally as

Code: Select all

java -jar /Applications/oxygen/lib/jing.jar schema.sch file.xml
it complains about the non-XPath 1.0 syntax.

This is an issue only because I would like a third party to be able to validate files against my Schematron schema, and they may or may not have oXygen available.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hi David,

You cannot use XPath 2.0 expressions in your Schematron schemas if your other tool is Jing, because Jing uses its own Schematron validator, which does not support XPath 2.0. In order to use XPath 2.0 expressions you have to modify the template with the match attribute match="sch:schema | schema" in skeleton1-5.xsl so that it generates <axsl:stylesheet version="2.0"> instead of <axsl:stylesheet version="1.0"> and use the usual process to validate file.xml against schema.sch using skeleton1-5.xsl: apply skeleton1-5.xsl to schema.sch to generate schema.xsl, apply schema.xsl to file.xml to get the Schematron validation error messages. Of course if you include XPath 2.0 expressions in schema.sch the stylesheets skeleton1-5.xsl and schema.xsl must be applied with an XSLT 2.0 processor.

Regards,
Sorin
dsewell
Posts: 125
Joined: Mon Jun 09, 2003 6:02 pm
Location: Charlottesville, Virginia USA

Post by dsewell »

Aha. Looking at oxygen.jar, I see that skeleton1-5.xsl is built into it. So if I need to share a Schematron schema with someone who does not have oXygen, I will need to give them that file separately. This makes sense.

Thanks,

David S.
Post Reply