Filtering one set of elements based on another

R

RogerTBrick

This is probably dead simple - but it's getting late and I've be
staring at XSL for waaaay to long!

I have an XML file that basically contains two lists:
<root>
...
<list name="allItems">
<value>A</value>
<value>B</value>
<value>C</value>
</list>
<list name="exclude">
<value>A</value>
</list>
...
</root>

I want to be able to select all the value elements from the "allItems"
list that are NOT in the "exclude" list. I have soft-of-a solution
involving a few templates and if statements - yet I'm sure there's an
elegant way to do this with XPath, but I can't think of it.

And it's beginning to do my head in.

Cheers,

Jason "My head hurts" Irwin.
 
D

David Carlisle

I want to be able to select all the value elements from the "allItems"
list that are NOT in the "exclude" list.


select="list[@name='allItems']/value[not(.=../../list[@name='exclude']/value)]"

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top