XPATH 2.0 matches function in embedded ISO Schematron

This should cover W3C XML Schema, Relax NG and DTD related problems.
mrsweeg
Posts: 9
Joined: Wed Oct 10, 2007 5:16 pm
Location: Charlottesville

XPATH 2.0 matches function in embedded ISO Schematron

Post by mrsweeg » Wed Oct 10, 2007 5:26 pm

I'm embedding ISO Schematron rules in my RelaxNG schema (TEIP5 with local extensions) using oXygen 8.2 with Schematron XPath Version set to 2.0;

Given this element definition with embedded Schematron assertion:
<element name="chronList">
<a:documentation xmlns:a="http://relaxng.org/ns/compatibility/ann ... 1.0">Local
Extension: "chronList"--a "non-TEI" element contains the model "eventLike" for use in
timeline feature of EV.</a:documentation>
<sch:pattern name="chronlist key attribute values">
<sch:rule context="//tei:chronList/tei:event">
<sch:assert test="@key[contains(., 'cl')]">You must begin your event key value with the letters "cl"!</sch:assert>
</sch:rule>
</sch:pattern>
</element>

Everything runs fine. However, if I change the assert test to:
<sch:assert test="@key[matches(., 'cl([0-9]+)')]">You must begin your event key value with the letters "cl" followed by one or more numbers!</sch:assert>

I get the following error:

Description: Error in expression @key[matches(., 'cl([0-9]+)')]: Unknown system function: matches

Am I using the matches function incorrectly here? Or is something else going on? Any help would be great thanks!
Matthew

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache » Fri Oct 12, 2007 4:04 pm

Hello,

An ISO Schematron schema must declare that it uses XSLT 2.0 expressions with the attribute queryBinding="xslt2" on the schema root element. In the case of embedded Schematron rules there is no schema root element so XSLT 2.0 cannot be specified. The XSLT version of embedded Schematron rules can be forced to be always 2.0 with a patch applied to oXygen. Please contact us to give you the patch. In a future version of oXygen we will add an user preference for setting the XSLT version of embedded ISO Schematron rules to 1.0 or 2.0.


Regards,
Sorin

Post Reply