Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] [schemas] non-deterministic content model avoidance

From: "Rick Jelliffe" <rjelliffe@-------.---.-->
To: xml-dev@-----.---.---
Date: 9/8/2004 3:33:00 AM
> additionally, i'd like to know whether Schematron can be used for
> editing purposes or not (i don't think so), that is to say if one can
> predict if an element is available with a given context, for example.

If you write the Schematron schema for that purpose, yes it could be used
to guide editing. Imagine an editor that filters out messages except those
relating to the most recent element (or that only checks assertions where
the context node matches the current element).

Then we have the schema:

<sch:phase name="guidance">
 <sch:active pattern="edit"/>
</sch:phase>

...

<sch:pattern id="edit">

  <sch:rule context="page/*">
    <sch:report test="position() mod 2 = 0" >
      An "odd" tag can be inserted after this element.
    </sch:report>
    <sch:report test="position() mod 2 = 1"  role="edit">
      An "even" tag can be inserted after this element.
    </sch:report>
  </sch:rule>

  <sch:rule context="page>
    <sch:report test="true()"  role="edit" >
      The first tag allowed is "odd".
    </sch:report>
  </sch:rule>

</sch:pattern>

Note that for validation with Schematron you don't need to try to
express the grammar: that is putting the cart before the horse.
So rather than trying to say "You can have zero or more
Odd each followed by an Even, with an optional Odd at the end"
you say "the page is empty, or starts with an odd;
only odds follow evens; only evens follow odds"

<sch:pattern id="sequences">
  <sch:rule context="page">
the page is empty, or starts with an odd;
only odds follow evens;
only evens follow odds"


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent