[relaxng-user] Is a deterministic schema possible for my index model?

Fredrik Lindgren fredrik.lindgren at chello.se
Fri Dec 17 10:08:17 ICT 2004


I have not verified it, but what about specifying the pattern as:
pages = (pgrom+, pg*) | pg+
This pattern should be equivalent to the initial pattern since any  
sequence that starts with a pgrom will be handled by the first choice,  
while the second choice takes care of the rest.
The non-deterministic thing is due to the possibility of a pgrom element  
matching either choice in the generated fragment.

Fredrik Lindgren
On Thu, 16 Dec 2004 14:29:07 -0500 (EST), David Sewell  
<dsewell at virginia.edu> wrote:

> (First post from me)
>
> I'm developing a RelaxNG schema to mark up back-of-the-book indexes.
> Leaving out refinements like "see also" references and nested
> subentries, an index consists of multiple entries. Each entry has a
> heading, and one or more page references. I want to use distinct XML
> elements for front-matter (roman) pages and body (arabic) pages.
> The relevant part of the schema (compact syntax) is this definition:
>
> 	pages = (pgrom+, pg*) | (pgrom*, pg+)
>
> I.e., there has to be at least one front-matter page or one body page.
>
> Trang turns this into the following DTD fragment:
>
> 	<!ENTITY % pages "(pgrom+,pg*)|(pgrom*,pg+)">
>
> while the XML schema equivalent is a group containing a choice between
> two <xs:sequence> elements. In either case if I attempt to validate a
> document instance I get a complaint about a non-deterministic content
> model.
>
> Is this just one of those places where Relax NG does something that you
> can't do with a DTD or W3C schema? If I want a translatable index
> schema, will I have to write
>
> 	pages = pgrom*, pg*
>
> and therefore permit empty content for "pages"?
>
> David S.
>


More information about the relaxng-user mailing list