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:extension> </xs:complexType> <xs:element name="employee" type="this:employee" /> <xs:complexType name="employee"> <xs:extension base="this:person"> ... </xs:extension> </xs:complexType> 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')]"> ... </xsl:template> 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)  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> <xsl:template match="this:director"> <!-- apply the next matching template to this node --> <xsl:next-match /> ... output for directors ... </xsl:template> Or at least that's how I imagined it. Cheers, Jeni  http://www.w3.org/TR/xslt20req --- Jeni Tennison http://www.jenitennison.com/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format