[xsl] Re: Need some help with an XPath

Subject: [xsl] Re: Need some help with an XPath
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Fri, 21 Feb 2003 22:57:30 +0100
Use:

/*/*/service[
                   not(@servId = /*/*[1]/*/@servId
                      and
                         @servId = /*/*[2]/*/@servId
                      and
                        @servId = /*/*[3]/*/@servId
                         )
                    ]



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL



"Adam van den Hoven" <list@xxxxxxxxxxxxxxxxxxx> wrote in message
news:2CFBE0D9CD992F41BE13069173C5C1C94B8445@xxxxxxxxxxxxxxxxxxx
> 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
>
>




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


Current Thread