Subject: Re: Identifier attribute (was: Re: Creating Hierarchy)
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Fri, 24 Oct 2008 14:50:19 +0200
|
Rowan Sylvester-Bradley schrieb:
Now I've got a further problem - the second pass is inserting the
values in the id attributes, but it's dropping any other attributes
that are in the result of pass1.
Hi Rowan,
just add an xsl:copy-of to copy the attributes as follows:
<xsl:template match="*[@id]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="id">
<xsl:number level="any" count="*[@id]"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
This copies all attributes, including @id. The xsl:attribute that
follows then adds another @id with the value you want, which overrides
the first one.
Michael Ludwig
|