XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] Type substitution vs. element substitution (aka substitution groups)

> I would like to support variable content in certain elements 
> of my schema based on the elements belonging to a common type 
> hierarchy. I want to make sure that the approach I take is:
> 
>     * Well suited for binding to programming languages using popular
>       data binding tools such that the resulting bindings allow
>       operating on the variable content based upon their common type
>       (poetntially abstract)

Can't advise on data binding, I'm not up to date with what the tools
support.

>     * Well suited for processing instance documents by XSLT such that
>       adding new types to the variable content hierarchy does not
>       require modifying the XSLT for processing the common elements and
>       attributes of the variable content base type
> 
XSLT 2.0 with schema-awareness can handle both type hierarchies and
substitution groups. For example you can match all elements in the
substitution group of event using

<xsl:template match="schema-element(event)">

and you can match all elements of type event-type using

<xsl:template match="element(*, event-type)">

and of course in both cases you can match any name at any level of the
hierarchy.

I would certainly use substitution groups where they make sense: they seem
closer to the semantics of the data model.

Michael Kay
http://www.saxonica.com/



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS