Re: [transquery-discuss] Schematron

From: Francis Norton (francis@redrice.com)
Date: Mon Jan 21 2002 - 00:47:31 CET


Hi Evan,

Evan Lenz wrote:

> Francis and others who have experience with Schematron (Leigh, etc.): it
> would be great to hear the details of how you think TransQuery input (as
> described in the current spec) could be used in the context of
Schematron.
> This would be a great help to those of us who haven't used Schematron
(but
> understand the basic idea). An example or two would be great.
>

Say forms.xml contains a root element <forms>, which wraps a list of
<form>s and fields.xml has <fields> containing a list of <field>s, and
you want to implement a rule that all the <field>s referred to from any
<form> must exist in fields.xml. Currently you could start by hacking
all the xml files in the directory into a single file with a single
temporary root, and then actually run a schematron schema over that. I
might have a rule like this:

<sch:pattern name="Using Elements Correctly">
        <sch:rule context="forms/form/field">
                <sch:assert test="@name = //fields/field/@name"
>this form has an undefined field.</sch:assert>
        </sch:rule>

you'll notice that I have carefuly phrased the rule so that it will work
despite the temporary common root, but the rule would be less of a hack
if I could simply phrase it like this:

<sch:pattern name="Using Elements Correctly">
        <sch:rule context="forms/form/field">
                <sch:assert test="@name = tq:input/fields/field/@name"
>this form has an undefined field.</sch:assert>
        </sch:rule>

So the validation process would read all the xml files into memory and
pass them into the schematron schema as tq:input, rather than generating
   a temporary file with a tacky temporary root.

Francis.



This archive was generated by hypermail 2.1.4 : Fri Feb 22 2002 - 11:35:58 CET