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

Need some help with an XPath

Subject: Need some help with an XPath
From: "Adam van den Hoven" <list@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 21 Feb 2003 11:49:37 -0800
need some adam
I have a node set that looks something like:

<branch>
    <service servId="Service 1" /> 
    <service servId="Service 3" /> 
    <service servId="Service 4" />
</branch>
<branch>
    <service servId="Service 1" /> 
    <service servId="Service 2" /> 
    <service servId="Service 4" />
</branch>
<branch>
    <service servId="Service 1" /> 
    <service servId="Service 3" />
    <service servId="Service 4" />
</branch>

Now what I want is a set of all the service elements that do not appear
in ALL the branch Elements. In this case I'm hoping for 

    <service servId="Service 3" />
    <service servId="Service 2" />
    <service servId="Service 3" />

Although the extra "Service 3" doesn't really need to be there, the way
I'll be using it doesn't care. 

Now my first thought was:

"All the services elements where the number of branch elements does not
equal the number of branch elements containing this service element" 

the XPath for this (assuming $branch contains the nodeset in question) :

service[count($branch) != count($branch[service = ???])]

The problem is that I'm not sure what to replace the ??? with. Clearly a
period isn't going to work. Neither is current().

Now I could use a for-each but I know better than to start there. I have
a suspicion that keys will fit in the solution but I'm not 100% sure
where. 

Any ideas?

H. Adam van den Hoven
Web Developer
Credit Union Central of BC
p 604 7306380
e avandenhoven@xxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.