OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] XML Schema to relaxNG xslt

[ Lists Home | Date Index | Thread Index ]

Note:  ... in this posting is a metasymbol meaning "anything syntactically
correct", not a part of RELAX NG compact syntax.

Dare Obasanjo scripsit:

> Extensible types are a major feature of W3C XML Schema and I don't think
> I've seen many schemas that do not use them. A RELAX NG mapping of an
> XSD document that doesn't replicate this functionality one way or the
> other is a non-starter for most of the uses of XSD that I've seen. 

How's this:

basicNameType =
	element firstName { text },
	element MI { text }?,
	element lastName { text }

extendedNameType =
	basicNameType,
	element generation { "Jr." | "Sr." | "II" | "III" | "IV" | "V" }?,
	element title { "Mr." | "Mrs." | "Miss" | "Ms." | "Dr." }?

Does that replicate the functionality sufficiently?  Of course the definitions
can be in separate schema files.

> A lot of functionality falls under extensible types including
> polymorphism via substitution groups and xsi:type which I do not see
> RELAX NG being able to do. 


h1 = element h1 { ... }
h2 = element h2 { ... }
h3 = element h3 { ... }

h = h1 | h2 | h3 | ...

Wherever h is referenced, an h1 or h2 or ... element may appear.  There
is no constraint that they have compatible content models, though.

> I also don't see any RELAX NG equivalent to the identity constraints
> xs:unique, xs:keyref and xs:key.

Quite correct.  RELAX NG understands only DTD-equivalent identity constraints;
viz: attributes of type xsd:ID, xsd:IDREF, and xsd:IDREFS.

> Is there anything akin to xs:redefine in RELAX NG? I couldn't find it in
> a cursory reading of the tutorial or the spec.   

Yes.  If you say:

include "subspec" {
	foo = ...
	bar = ...
	baz = ...
	}

then any definitions for foo, bar, and baz in "subspec" are redefined.
Furthermore, you can write:

foo = ...

foo |= ...

foo |= ...

and the three definitions (which may reside in different files) will be
or'd (choice'd) together.  Ditto for "&=" definitions, but they are
interleaved.

-- 
John Cowan <jcowan@reutershealth.com>     http://www.reutershealth.com
I amar prestar aen, han mathon ne nen,    http://www.ccil.org/~cowan
han mathon ne chae, a han noston ne 'wilith.  --Galadriel, _LOTR:FOTR_




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS