Re: [xsl] Change of Attribute Value

Subject: Re: [xsl] Change of Attribute Value
From: Ragulf Pickaxe <ragulf.pickaxe@xxxxxxxxx>
Date: Thu, 3 Nov 2005 11:42:03 +0100
Hi fabrice,

This is just a very quick solution from the top of my head. Not
tested, and I am a little sure of the copy-of on the remaining
attributes - the test for not choosing the name. Another one might
help you out here.

<xsl:template match="node">
  <xsl:copy>
    <xsl:attribute
name="name">concat((ancestor::node)[2]/@name,@name"</xsl:attribute>
    <xsl:copy-of select="@*[not(self::@name)]"/>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

<xsl:template match="*[not(self::node)]">
  <xsl:copy-of select="."/>
</xsl:template>

Regards,
Ragulf Pickaxe :-)

> so basically, i want to skip the first level of element <node>, and then
> pick up the attribute @name value of the second level and concat it to all
> sublevel attributes @name
>
> I'm sure this is possible using some kind of recusion.
> Any help, would be much appreciated.
>
> Thanks in advance.
> fabrice

Current Thread