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

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


Subject: Re: [xsl] recursion with xsl:apply-templates
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 27 Aug 2003 12:37:05 +0100

> Anyway, my primary problem remains. Any ideas?

I'm not sure quite what transform you wanted, but i think it's just an
identity transform plus copying the  @index'th id element from the
idlist??

which would be

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- identity -->
<xsl:template match="*">
 <xsl:copy>
 <xsl:copy-of select="@*/>
 <xsl:apply-templates/>
 </xsl:copy>
</xsl:template>

<!-- ignoring HEADER as you don't show that closing, assuming here that
all your REC_IR... elements are children of IRC 
It's _much_ easier if exampe input documents are complete (but short)
well formed documents -->

<!-- children of IRC with an index attribute
don't copy index and do copy id from id-list -->
<xsl:template match="IRC/*[@index]">
 <xsl:copy>
 <xsl:copy-of select="@*[not(name()='index')]/>
 <xsl:copy-of select="../../id_list/*[position()=current()/@index]"/>
 <xsl:apply-templates/>
 </xsl:copy>
</xsl:template>

</xsl:stylesheet>

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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



Current Thread