Schematron schema with castable fails to compile

This should cover W3C XML Schema, Relax NG and DTD related problems.
mat_koop
Posts: 4

Schematron schema with castable fails to compile

Wed Nov 28, 2012 12:24 pm

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?
adrian
Posts: 2337

Re: Schematron schema with castable fails to compile

Wed Nov 28, 2012 1:44 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
mat_koop
Posts: 4

Re: Schematron schema with castable fails to compile

Wed Nov 28, 2012 1:52 pm

Thanks Adrian, this solves the problem.
Matthijs

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 1 guest