[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: Mon, 11 Apr 2005 17:34:10 -0700
rush manbert
More info (sorry I didn't put it in the first post)

Rush Manbert wrote:

I want to create a global variable that contains the result tree fragment contained within element <c>, with the following restrictions:
I only want to include the first <y> element that is contained within <c>, no matter where it occurs. There may be no <y> elements present.
I want to exclude all <z> elements that are contained within <c>, no matter where they occur. Again, there may be none present.


I have tried many variations on the select portion of the variable definition. I can filter the immediate children of <c>, OR the second level children, etc., but I can't seem to come up with anything that handles <y> and <z> appearing at any depth in the descendant tree.

Some things I have tried:
<xsl:variable name="set" select="/a/b/c/*[((name() != 'y') and (name() != 'z'))] | /a/b/c//y[1]" />


<xsl:variable name="set" select="/a/b/c/descendant::*[((name() != 'y') and (name() != 'z'))] | /a/b/c//y[1]" />

Then I tried to just exclude <z> at any level:
<xsl:variable name="set" select="/a/b/c/descendant::*[not(self::z)]" />
but that only excludes <z> elements that are children of <c>.

I'm using xsltproc, built with libxml 2.6.19 and libxslt 1.1.14

- Rush

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.