xsl-list
[Top] [All Lists]

Re: [xsl] Identifier attribute (was: Re: [xsl] Creating Hierarchy)

2008-10-24 08:50:55
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="*[(_at_)id]">
    <xsl:copy>

<xsl:copy-of select="@*"/>

      <xsl:attribute name="id">
        <xsl:number level="any" count="*[(_at_)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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--