Subject: Re: [xsl] Recursive substitution From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 3 Nov 2005 21:11:24 GMT |
> Unfortunately my problem is that I did want to use a "copy-of" so that the nodes being referred to > by the <ref> tag are actually "stitched" into the tree. I have no idea what you mean by stiched here. The code I posed roduced the output you saod you needed, if in fact you need different output I suggest that you repost with a different sample result. I applied templates to the refereneced nodes. > <xsl:template match="ref"> > <xsl:apply-templates select="key('r',@name)"/> > </xsl:template> You generate a new tree in memory that consist just of a document node with child the referenced nodes, and then apply templates to that. <xsl:template match="ref[@name]"> <xsl:variable name="x"> <xsl:copy-of select="key('r',@name)"/> </xsl:variable> <xsl:apply-templates select="$x"/> </xsl:template> This takes mre memory, because of the copy but will produce the smae result unless your have a template matching / that does something other han the default action of applying templates to your children, or if the templates that match the referenced nodes use Xpath expressions to select their parsents or any other ancestor, as in my version they will have the parents they had in the original tree, but in your version the tree only has these nodes,all with parent / David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. 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 ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Recursive substitution, Agnisys | Thread | Re: [xsl] Recursive substitution, Agnisys |
Re: [xsl] Concordance with XSLT, Robert Koberg | Date | Re: [xsl] XPath 2.0 / XSLT 2.0 stat, Wendell Piez |
Month |