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

Re: Recursive substitution

Subject: Re: Recursive substitution
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 3 Nov 2005 21:11:24 GMT
child xsl
> 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

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.