[
Lists Home |
Date Index |
Thread Index
]
Hi John,
> Question: does XPath/XSLT 2.0 grok substitution groups, such that
> you *could* write simply "//time" in a stylesheet and match either
> time-simple or time-complex elements?
Yes, or almost, as long as you have a schema-aware processor and
you've imported the relevant schema. If you have a schema that
contains:
<xs:element name="time" />
<xs:element name="time-simple" substitution-group="time" />
<xs:element name="time-complex" substitution-group="time" />
then you can match <time>, <time-simple> and <time-complex> elements
with the node tests "element(time)" or "element(time,*)". So you can
have a template like:
<xsl:template match="element(time)">...</xsl:template>
to match all three elements. However, a template like:
<xsl:template match="time">...</xsl:template>
will still only match an element that is actually called "time".
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
|