[relaxng-user] trang and xsd-friendly schemas

Bruce D'Arcus bdarcus at fastmail.fm
Sat Sep 11 23:51:57 ICT 2004


This list has been quiet.  Anyone there?

OK, I'm working on a schema for which I am taking advantage of RELAX 
NG-specific features like interleave and attribute-based validation (I 
use a class attribute on the root to drive validation throughout the 
schema).  While I have no interest in supporting conversion to DTD (at 
least for now), I would like to be able to get a clean XSD using Trang.

Trang will convert the current schema to XSD, but when I try to 
validate an instance against it, I get errors related to the following 
original RNC patterns:

Entry.Biblio = element entry { (RefType-Book |
    RefType-Article |
    RefType-Chapter ),
    RefType*
}
RefType-Book = element reftype {
    attribute name { "book" },
    Formatting.Elements
}
RefType-Article = element reftype {
    attribute name { "article" },
    Formatting.Elements
}
RefType-Chapter = element reftype {
    attribute name { "chapter" },
    Formatting.Elements
}
## Beyond the mandatory definitions, the list of reference types
## is uncontrolled.
RefType = element reftype { attribute name { text },
    attribute inherit-from { text }?,
    attribute group { "yes" }?,
    Formatting.Elements
}

Here are the errors:

> The content model must be deterministic. Multiple definition of 
> element 'http://xbiblio.sourceforge.net/xcs:reftype' causes the 
> content model to become ambiguous. An error occurred at , (225, 6).
>
> Elements with the same name and in the same scope must have the same 
> type. An error occurred at , (605, 8).
>
> Elements with the same name and in the same scope must have the same 
> type. An error occurred at , (624, 8).
>
> Elements with the same name and in the same scope must have the same 
> type. An error occurred at , (643, 8).

Any suggestions on how to better handle this?

Also, is there any problems using interleave in this context?  I have a 
few patterns that look like this:

	Part = element part-details { Formatting.Attributes, ( Volume? & 
Issue? & Pages? & Date? ) }

Bruce



More information about the relaxng-user mailing list