Page 1 of 1

Schematron schema with castable fails to compile

Posted: Wed Nov 28, 2012 12:24 pm
by mat_koop
Hi,

I'm trying to validate a date by using castable in a schematron file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<pattern>
<rule context="//meta[@name='OVERHEIDop.einddatum']">
<assert test="@content castable as xs:date">Geen juiste datum</assert>
</rule>
</pattern>
</schema>
I can transform this sch file to an XSLT with the ISO iso_svrl_for_xslt2.xsl stylesheet, and then use the result to validate a document. So it seems the above sch file is OK.

However, trying to apply the above .sch file directly to the same example XML document in Oxygen 11.2 Professional returns a warning:
SystemID: /Users/matthijs/Dropbox/werk/nieuwe_opzet/metadata/code/genereer_schematron/test_juni_2012/castable_test.sch
Engine-naam: ISO Schematron
Ernst: warning
Omschrijving: Error in expression @content castable as xs:date: Unexpected token <name> beyond end of expression
And ultimately a fatal error.

It is a bit of a hassle to not be able to use Oxygen for quick debugging of sch files.

Any thoughts how to solve this?

Re: Schematron schema with castable fails to compile

Posted: Wed Nov 28, 2012 1:44 pm
by adrian
Hello,

You are using "castable as" which is only available in XSLT/XPath 2.0. To make this work, you have to specify on the schema root the attribute:
queryBinding="xslt2"

Regards,
Adrian

Re: Schematron schema with castable fails to compile

Posted: Wed Nov 28, 2012 1:52 pm
by mat_koop
Thanks Adrian, this solves the problem.
Matthijs