This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: The notion of Inheritance?
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] The notion of Inheritance?
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Thu, 29 Mar 2001 10:25:06 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> Can XML/XSL have the notion of inheritance?
No, it doesn't. If you were using attributes rather than elements you could
achieve something along the right lines with a template rule such as
<xsl:template match="person">
<person>
<xsl:copy-of select="person[@id=1]/@*"/>
<xsl:copy-of select="@*"/>
</person>
</xsl:template>
This relies on the fact that when outputting attributes, the last attribute
with a given name overrides earlier attributes with the same name.
You're not using attributes, but you could convert the elements to
attributes in a pre-pass. The alternative is a lot of <xsl:choose> logic.
Mike Kay
Software AG
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list