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: Cristobal Galiano Fernandez <c dot galiano at ua dot es>
- Date: Thu, 29 Mar 2001 16:31:23 +0200
- Organization: Universidad de Alicante
- References: <001b01c0b832$63f6d410$0100007f@PCUKMKA>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Michael:
I don't understand what you can say. Perhaps a way to update elements
attributes? Can you write an short, but full (XML & XLL) example.
Perhaps this XML is good for you (?)
<?xml version="1.0" encoding="ISO-8859-1"?>
<Data>
<person id="1" Nombre="Cristóbal" apell1="Garcia" apell2="Fernández"
edad="23" apell1="GalianoUpd" />
<person id="1" Nombre="Cristóbal-Up1" />
<person id="1" apell2="Fernández-Up3" edad="24" />
<person id="2" Nombre="Rocio" apell1="Senda" apell2="Zapata" edad="21" />
<person id="3" Nombre="Alicia" apell1="Melliza" apell2="Joquer" edad="22" />
</Data>
Thanks in advance
Cristóbal G.F
Michael Kay escribió:
> > 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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list