[dsdl-discuss] Re: ISO Schematron draft

From: Rick Jelliffe <ricko@allette.com.au>
Date: Wed Jul 28 2004 - 08:18:50 UTC

Martin Bryan wrote:

>Rick
>
>Am in a rush with the CSW Summer School coming up on Sunday, so I haven't
>got time to research a problem my team have thrown me re Schematron. They
>want to use Schematron to validate the responses made in forms without
>having to set up Schema datatypes for specific XML fields. OK, you can use
>XPath statements, some of which mimic W3C datatypes, but I can't see offhand
>how you can use a pattern, or something like gMonthYear in a Schematron
>test. Is there something obvious I'm missing?
>
>For DSDL we said that we'd allow users to use any datatype spec in
>conjunction with the language. How can user-defined datatypes be used in
>assertions in IS-Schematron?
>
>
Schematron is a framework; all issues of datatype belong to the query
language
being used (XSLT by default).

If you use EXSLT rather than XSLT as the default query language, that
includes
date and time functions. See www.exslt.org I believe that XSLT2
and XQuery
also have date datatypes available. If you are using EXSLT, you set the
the sch:schema/@language to "EXSLT" and then your assertions can include,
for example,
    assert="date:year(@effectivity) > 2000"
which (if I understand EXSLT) parses your @effectivity attribute value,
returns the
year as a number, and tests it against 2000.

Even with vanilla XSLT, you can use the <let> variables to progressively
parse
a date into its component parts. (This was, in fact, why <let> was
introduced:
because the Portuguese experience with handling data in their XSCL
constraint
language, which is similar to Schematron, showed how useful it is for taming
things.)

This kind of thing shows why Schematron is a framework, not hard-wired
(except
by default) to XSLT. Plain XSLT will be superceded in short measure, at
least
by EXSLT, though perhaps by XSLT2.

EXSLT is supported by Microsoft's MSXML, the W3C's libxslt and quite a
few others.
I know some people are using it with Schematron, though I never have,
actually.
I know of two efforts to develop a (draft) ISO Schematron implementation:
there is a .NET version under way, and a Java (Jaxen) version. I also
have a
background effort in Java under way, though I am not sure I won't just
fix up
James' version. MicroSoft's guy in charge of XML API development for
Longhorn has publicly talked about adding Schematron as part of the Longhorn
XML API: we will see.

Cheers
Rick

--
DSDL members discussion list
To unsubscribe, please send a message with the
command  "unsubscribe" to dsdl-discuss-request@dsdl.org
(mailto:dsdl-discuss-request@dsdl.org?Subject=unsubscribe)
Received on Wed Jul 28 10:49:54 2004

This archive was generated by hypermail 2.1.8 : Fri Dec 03 2004 - 14:00:28 UTC