I have an XML document that I would like to remove/filter whole nodes
(and their child nodes) if an attribute is not contained/matched. I
would like to output a new XML document, not modifying the original.
Can anyone recommend XSLT for this or a programmatic way if it's
faster?
<item look="a;b">
<item look="a;b">
<subitem/>
<subitem/>
<item look="a">
<subitem/>
</subitem/>
</item>
</item>
<item>
I would like to apply an expression to the above document, so any
<item> element that does not have a "b" in the look attribute is
removed. I would like the result XML document to be:
<item look="a;b">
<item look="a;b">
<subitem/>
<subitem/>
</item>
<item>
Thanks.
Mubashir Khan - 06 Nov 2006 11:19 GMT
i guess you can use xpath queries ....
> I have an XML document that I would like to remove/filter whole nodes
> (and their child nodes) if an attribute is not contained/matched. I
[quoted text clipped - 25 lines]
>
> Thanks.
xeroxero - 06 Nov 2006 16:44 GMT
That is not going to work. The original XML document is generated
dynamically. I think I need to do XSLT or some kind of
iterative/dynamic XPath technology. Can anyone provide a sample?
>i guess you can use xpath queries ....
>>
[quoted text clipped - 27 lines]
>>
>> Thanks.