[relaxng-user] trang and xsd-friendly schemas

Bruce D'Arcus bdarcus at fastmail.fm
Mon Sep 13 08:02:00 ICT 2004


On Sep 13, 2004, at 7:42 AM, G. Ken Holman wrote:

>> I would like to be able to get a clean XSD using Trang.
>
> I see the above two requirements as irreconcilable.  You can have one 
> or the other, but you cannot have both.
>
>> 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:
>
> Sure you do ... all of the errors that were reported make sense to me 
> and I couldn't express them any better myself.  You've asked for 
> non-XSD semantics in XSD syntax, so unsurprisingly you are going to 
> get errors reported regarding what is or is not allowed in the 
> semantics of a document model described by XSD.

I'm sure you got a hint in my message that I recognize there are things 
that XSD cannot express.  Nowhere was I suggesting (or even vaguely 
hinting) that Trang was at fault.

I'm not asking for complete fidelity; I'm asking for the best strategy 
to use in designing the schema to create a reasonable approximation in 
XSD.

James gave me the following off-list comment (I had emailed him asking 
why the list wasn't working):

> I would suggest that you create two RELAX NG schemas:
>
> A. One taking full advantage of RELAX NG features
>
> B. One sticking relatively close to the functionality of XSD
>
> Make A include B and override the parts where RELAX NG can do better.
> Then use B to generate the XSD.

So is the original non-deterministic because chapter would also be a 
valid attribute value in the second pattern below?

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
}

And once I adjust that to convert properly, what else do I avoid using 
in B?

With regard to interleave in RNG, ould a good alternative be something 
like this in B ...

	( A | B | C )*

... and then I can override with interleave in A?

Bruce



More information about the relaxng-user mailing list