[xsl] Need some help with an XPath

Subject: [xsl] Need some help with an XPath
From: "Adam van den Hoven" <list@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 21 Feb 2003 11:49:37 -0800
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