[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] The notion of Inheritance?


Subject: RE: [xsl] The notion of Inheritance?
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Thu, 29 Mar 2001 10:25:06 +0100

> 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



Current Thread