Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Recursive substitution

From: David Carlisle <davidc@--------->
To:
Date: 11/3/2005 9:15:00 PM
> 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
________________________________________________________________________


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent