This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: The notion of Inheritance?


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]