xsl-list
[Top] [All Lists]

Re: recursion with xsl:apply-templates

2003-08-27 06:10:06
Dear David, Mike, Andrew,

thanks very much for help and quick responses. Seems that I stuck on my recursion too much. Based on your input I'm now using the follwing code, which works as expected:

  <xsl:template match="/transformation">
    <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="*[(_at_)index]">
    <xsl:copy>
      <xsl:copy-of select="@*[not(name()='index')]"/>
      <xsl:variable name="p" select="count(preceding::*[(_at_)index])+1"/>
      <xsl:copy-of select="/transformation/id_list/id[$p]"/>
      <xsl:copy-of select="child::node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="id_list"/>

Davis: next time I'll provide a better input!

Volker.


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list