[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: [schemas] non-deterministic content model avoidance


xml content model

> 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"



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.