Page 1 of 1
ISO Schematron with XPath 2.0
Posted: Sun May 27, 2007 11:21 am
by moreno
Hi,
I don't know if this is possible in Oxygen 8.2, but I'd like to have XPath 2.0 as the query language in ISO Schematron schemas. I tried the option "XML / XML Parser / Schematron XPath Version", but it seems to work only with Schematron 1.5 schemas, right?
Another issue: when editing an XML document that uses an XML Schema with embedded schematron, the "validation as I type" engine is not reporting assertions from schematron rules. Is it a missconfiguration? Or, since it was working until version 8.1, is it a recent design decision?
BTW, these two issues made me switch back to Oxygen 8.1 and schematron 1.5.
Thanks in advance,
Marcelo Moreno
Posted: Sun May 27, 2007 11:30 am
by george
Hi,
In ISO Schematron you have a queryBinding attribute in sch:schema element that can be set to xslt2 to specify that you want to use XSLT 2.0 language binding. That will enable usage of XPath 2.0 inside your ISO Schematron schema. I have to see what happens if the schema is embedded - in that case there is no sch:schema so no queryBinding attribute.
I will look into the validation issue you mention and let you know.
Best Regards,
George
Posted: Sun May 27, 2007 12:14 pm
by moreno
Thanks, George!
Yes, some weeks ago I tested this queryBinding attribute in a standalone schematron schema. It worked correctly. But now I need to make it work with embedded rules, as you correctly deduced. I hope you find a way...
Anyway, it would be nice to have that "XPath Version" option under "XML / XML Parser / ISO Schematron" too.
About the validation thing, I'd like to be more specific: the embedded rules are written in schematron 1.5. I didn't test with ISO schematron.
Regards,
Moreno
Posted: Mon May 28, 2007 3:59 pm
by sorin_ristache
Hello,
moreno wrote:About the validation thing, I'd like to be more specific: the embedded rules are written in schematron 1.5. I didn't test with ISO schematron.
I tested validation as you type against an XML Schema with embedded Schematron 1.5 rules and another XML Schema with embedded ISO Schematron rules and the embedded rules were applied correctly in both cases. Make sure you include the XML Schema file both in the xsi:schemaLocation attribute and in the
oxygen processing instruction for Schematron schemas, for example:
Code: Select all
<?oxygen SCHSchema="Tournament.xsd"?>
moreno wrote:Anyway, it would be nice to have that "XPath Version" option under "XML / XML Parser / ISO Schematron" too.
We will consider allowing XPath 2.0 queries also in ISO Schematron schemas.
Regards,
Sorin
Posted: Mon May 28, 2007 4:44 pm
by george
Hi,
We decided to add a new option to allow controlling the queryBinding for embedded ISO Schematron rules. It will default to xslt2 and the other possible value will be xslt1.
As Sorin replied the validation of an XML document against a schema and its embedded Schematron rules should work - in addition note that you can make the association externally, in the Default Schema Association option page there you can specify XML Schema with embedded Schematron as schema type.
Best Regards,
George
Posted: Mon May 28, 2007 8:18 pm
by moreno
Hi,
Thanks, George. This is good news. Is it available right now?

When it will be?
Sorin, my documents were ok!
I think the problem occurs after choosing XPath 2.0 in "Schematron XPath Version" option. When I switch back to XPath 1.0, continuous validation works again.
So, try to reproduce it in the following manner: Start with a valid document; then select XPath 2.0 as schematron query language; then press "reset cache and validate"; and finally modify your document to break a schematron rule. What happens?
I used the documents below in my test:
xstest.xsd
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sch="http://www.ascc.net/xml/schematron">
<xs:element name="everything" type="xs:integer"/>
<xs:annotation>
<xs:appinfo>
<sch:pattern name="everything must be greater than 0">
<sch:rule context="//*">
<sch:assert test=". > 0">
everything must be greater than 0!
</sch:assert>
</sch:rule>
</sch:pattern>
</xs:appinfo>
</xs:annotation>
</xs:schema>
test.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen SCHSchema="xstest.xsd"?>
<everything xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xstest.xsd">
5
</everything>
Regards,
Moreno
Posted: Tue May 29, 2007 2:47 pm
by sorin_ristache
Hello Moreno,
Thank you for the example. I see that there is a problem with applying the embedded Schematron rules in the continuous validation if the Schematron XPath version is set to 2.0 in Preferences. We will fix that.
Thank you,
Sorin
Posted: Tue May 29, 2007 8:51 pm
by moreno
Hi, Sorin.
Thank you.
FYI, yesterday I translated all my embedded Schematron 1.5 rules to a standalone ISO Schematron schema, with queryBinding=xslt2. Continuous validation doesn't work in this case, too.
Regards,
Moreno
Posted: Wed May 30, 2007 9:42 am
by sorin_ristache
Yes, it is the same problem of ISO Schematron with XPath 2.0 queries. We will fix it.
Regards,
Sorin