XML Filter Fast Way?

  • Thread starter Thread starter xeroxero
  • Start date Start date
X

xeroxero

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.
 
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?
 
Back
Top