Re: Is a deterministic schema possible for my index model?
David Sewell <[email protected]> Fri, 17 Dec 2004 09:48:55 -0500 (EST)
| Newsgroups | gmane.text.xml.relaxng.general |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 17 Dec 2004, Fredrik Lindgren wrote: > 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. Thanks, that's perfect. As they say, "why didn't I think of that?" The DTD and XSD versions work as expected. Thanks also to David Pawson for the pointer to the DocBook index model--it's more complex than needed for my purposes, though. DS > Fredrik Lindgren > On Thu, 16 Dec 2004 14:29:07 -0500 (EST), David Sewell <[email protected]> > 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. > > > -- David Sewell, Editorial and Technical Manager Electronic Imprint, The University of Virginia Press PO Box 400318, Charlottesville, VA 22904-4318 USA Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903 Email: [email protected] Tel: +1 434 924 9973 Web: http://www.ei.virginia.edu/