[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

AW: [xsl] recursion with xsl:apply-templates


Subject: AW: [xsl] recursion with xsl:apply-templates
From: "Zink, Juergen" <Juergen.Zink@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 Aug 2003 16:02:49 +0200

Dear Volker,

instead of 
       <xsl:variable name="p" select="count(preceding::*[@index])+1"/>
do you mean this?
       <xsl:variable name="p" select="@index"/>
       <xsl:copy-of select="/transformation/id_list/id[$p]"/>
In your sample xml you have two rec... with the same value of @index.
Will they get the same id or not? Can you use the index?

Cheers,

Juergen

-----Ursprüngliche Nachricht-----
Von: Volker Witzel [mailto:volker.witzel@xxxxxxxxxxxx]
Gesendet am: Mittwoch, 27. August 2003 15:10
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: Re: [xsl] recursion with xsl:apply-templates

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="*[@index]">
     <xsl:copy>
       <xsl:copy-of select="@*[not(name()='index')]"/>
       <xsl:variable name="p" select="count(preceding::*[@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


*****************************************************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte 
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese 
eMail irrtuemlich erhalten haben, informieren Sie bitte sofort den 
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren 
sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. 
If you are not the intended recipient (or have received this e-mail 
in error) please notify the sender immediately and destroy this e-mail. 
Any unauthorized copying, disclosure or distribution of the material 
in this e-mail is strictly forbidden.
*****************************************************************************


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



Current Thread
Keywords
xml