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

Re: How to create a node set that excludes some desce

Subject: Re: How to create a node set that excludes some descendant elements?
From: Rush Manbert <rush@xxxxxxxxxxx>
Date: Tue, 12 Apr 2005 11:16:07 -0700
set rush 2005
Thank you, thank you, thank you Michael, Mukul and Aron for your replies.

Thanks for the explanation about node sets and result tree fragments. That is certainly confusing for me!

The big revelation to me here is that I can do this:

<xsl:variable name="subset">
 <xsl:apply-templates select="a" mode="subset"/>
</xsl:variable>

Then still be able to do this:

<xsl:apply-templates select="exslt:node-set($subset)" />

I was under the impression that I could only use $subset this way if I had defined it using this form:

<xsl:variable name="subset" select="some XPATH expression" />

(If I remember correctly, $subset would be worthless to me if I did something like this:
<xsl:variable name="subset">
 <xsl:value-of select="some XPATH expression" />
<xsl:variable>
which I thought generalized to anything of the form:
<xsl:variable name="subset">
 -- anything here --
</xsl:variable>
but that does not appear to be the case!)

My real application is much more complicated that the example I provided, involving multiple documents, but it now works the way I desired and I have a new tool to use. Thank you all for your kind help.

- Rush

Michael Kay wrote:

The example that you've given suggests that you do actually want to create a
new tree that is a selective copy of the original tree. The way to do this
is to walk the original tree applying templates. If a node is to be copied
into the new tree, you apply the identity template, if it is to be removed,
you apply an empty template, and of course you can also have templates that
modify selected elements. So it looks something like this:

<xsl:variable name="subset">
 <xsl:apply-templates select="a" mode="subset"/>
</xsl:variable>

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.