Subject: Re: [xsl] Does <xsl:copy> use a lot of memory? Is there an alternative that is more efficient? From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 03 Sep 2012 17:58:30 +0200 |
<x> <b id="i1">aaa</b> <b idref="i1"/> <b id="i2">kkk <c idref="i3"/></b> <b> aaa <c idref="i2"/></b> <b id="i3"> aaa <c idref="i2"/></b> </x>
<xsl:template match="*"> <xsl:copy> <xsl:copy-of select="@* except @idref"/> <xsl:apply-templates select="@idref,node()"/> </xsl:copy> </xsl:template>
<xsl:template match="@idref"> <xsl:param name="seen" tunnel="yes"/> <xsl:choose> <xsl:when test=".=$seen"><xsl:copy-of select="."/> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="key('id',.)"> <xsl:with-param name="seen" select="$seen,string(.)" tunnel="yes"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:template>
________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Does <xsl:copy> use a lot, Michael Kay | Thread | Re: [xsl] Does <xsl:copy> use a lot, Graydon |
Re: [xsl] Does <xsl:copy> use a lot, Michael Kay | Date | [xsl] [Announce] Training invitatio, G. Ken Holman |
Month |