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


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Types and Context

Hi Jonathan,

> Exactly. And if you stop to think about this, XML Schema "datatypes"
> are hardly going to revolutionize XSLT/XPath 2.0.

While I agree, given the example that you gave, surely the point of
getting datatypes in XSLT/XPath would be most obvious in conditions
where you have two elements that share the same type, either directly:

   <xs:element name="mother" type="this:person" />
   <xs:element name="father" type="this:person" />

Or indirectly:

   <xs:element name="director" type="this:director" />
   <xs:complexType name="director">
      <xs:extension base="this:person">

   <xs:element name="employee" type="this:employee" />
   <xs:complexType name="employee">
      <xs:extension base="this:person">

Here, the fact that this:mother and this:father share a type means
that they can be processed in the same way. In XSLT/XPath currently,
we would encode that by having them both matched by the same template.
But it would be more extensible if we had a way of matching *all*
elements of the this:person type instead:

  <xsl:template match="*[xs:type('this:person')]">

New elements of the this:person type that were added to the schema
would automatically be matched by this template, whereas in the
current situation I'd have to change the XSLT.

In the second example, something like the XSLT 2.0 requirement 2.17
for xsl:next-match (or similar) [1] could be really useful to help
me use the XML Schema type hierarchy to write modular XSLT:

  <xsl:template match="*[xs:type('this:person')]" priority="-1">
     ... output for all people ...

  <xsl:template match="this:director">
     <!-- apply the next matching template to this node -->
     <xsl:next-match />
     ... output for directors ...

Or at least that's how I imagined it.


[1] http://www.w3.org/TR/xslt20req

Jeni Tennison