I have two node sets where I’d like to output the value(s) of (a) node(s) if there are no matches. The logic would be the following:
If any of the values of the attributes “term” in Node Set #1 do not match any of the values of the “key” attributes in Node Set #2, output the “term” value(s) from Node Set #1. How would I do this?
Node Set #1
<stuff term="foo" />
<stuff term="bar" />
<stuff term="test" />
Node Set #2
<other key="time" />
<other key="rack" />
<other key="foo" />
<other key="fast" />
Assuming your XML looks like this
You could set up a key to look up the other elements based on their key attribute
Then, to select your stuff elements for which there is no matching other element, you would use the key like so
Try the following XSLT
When applied to the above XML, the following is output