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] RE: Namespace use cases

2009/7/10 Dan Brickley <danbri@danbri.org>:
> On 10/7/09 10:23, Michael Kay wrote:
>>> I would love to hear of some success or horror stories of
>>> multi-namespaces in authoring content.
>> A very simple success story is that it proved very easy to allow XML
>> Schemas
>> to be embedded in XSLT stylesheets, despite the fact that the vocabularies
>> were developed independently (without this in mind) and had overlapping
>> local names, eg. xsl:element vs xsd:element.
> Interesting. Can you flesh out the example --- why would someone want to do
> this?

You can embed the schema in the stylesheet, and then use the types to
check your input and/or output as its constructed.  For example:

<xsl:stylesheet version="2.0"

    <xs:element name="foo">
          <xs:element name="bar"/>

<xsl:template match="/" as="schema-element(foo)">
  <foo xsl:validation="strict">


In the above, a <foo> must contain a <bar>, but I'm generating
<foo>/<wrong>, so at runtime I get the message:

"Element wrong is not permitted in the content model of the complex
type of element foo; ... Line#: 18; Column#: 50"

This is better than just validating the result as it tells me where in
the XSLT I generated the invalid output.

Its nice to embed a small XSD for a few custom types, but as soon at
its gets to any size then it needs to be a separate file.

Andrew Welch
Kernow: http://kernowforsaxon.sf.net/

[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