[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: AW: recursion with xsl:apply-templates

Subject: Re: AW: recursion with xsl:apply-templates
From: Volker Witzel <volker.witzel@xxxxxxxxxxxx>
Date: Thu, 28 Aug 2003 09:21:47 +0200
xsl select text
Sorry David, obviously I did get you wrong then.

Anyway, I have a working and (thanks to Andrew) a performing solution for my problem now, which is only slightly different from Andrews, i.e. I need the ids as element, not as attribute.

Thanks again for your support and contributions!
Volker.

My solution:

<xsl:variable name="indexToIDs">
<xsl:for-each select="/transformation/IRF//*[@index]">
<xsl:variable name="pos" select="position()"/>
<entry genid="{generate-id()}">
<xsl:copy-of select="/transformation/id_list/id[$pos]"/>
</entry>
</xsl:for-each>
</xsl:variable>
<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:variable name="genid" select="generate-id()"/>
<xsl:value-of select="$genid"/>
<xsl:copy>
<xsl:copy-of select="xalan:nodeset($indexToIDs)/entry[@genid = $genid]/id"/>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@index"/>
<xsl:template match="id_list"/>



David Carlisle wrote:


it is like David assumed:


But your posted solution didn't do what mine did.
Mine took the value of the index attribute as the id element to copy
your solution ignored the value and counted the number of elements that
had that attribute.

David

________________________________________________________________________
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



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.