[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML Schema to relaxNG xslt


relax ng identity constraints
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@r...>     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_

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.