Subject: Re: [xsl] inheritance and encapsulation in xslt? / xslt for xlink?|
From: Howard Stearns <stearns@xxxxxxxxxxxx>
Date: Tue, 22 Jul 2003 14:29:48 -0400
David Carlisle wrote: > actually using xlink to get this processing seems rather odd. ... > XSLT1 of course doesn't see the XSLT at all so it can't automatically > read anything in teh schema, but even xslt2 which can know about the > schema structure wouldn't see this. If you (they) ae going to use xsd > why didn't they use xsd facilities for this? If for example the new > elements were in the substitution group of the old ones xpath2 would > automaticaly be able to cope.
... XML Schema is designed to manage this kind of situation (specialised elements used in place of general elements) using substitution groups. If you were using substitution groups instead of this XLink mechanism, then Schema-Aware XSLT 2.0 processors would be able to pick up on the fact that the <acme_slushFundCash> is a member of the substitution group <ci_unrestrictedCash>. You could then write templates like:
<xsl:template match="element(ci_unrestrictedCash)"> ... </xsl:template>
and this template would be used for every element that belonged to the ci_unrestrictedCash substitution group. You could also have specialised templates for the specialised elements, using template priority or import priority to override these more general ones.
So this would tackle precisely the problem that you're encountering, but it's very much something for the future, since:
(a) you're not using substitution groups in your schema, from what I can tell (b) XSLT 2.0 isn't yet a standard (c) there aren't any (even experimental) Schema-Aware XSLT 2.0 processors around that you could use