XML Filter Fast Way?

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.
 
X

xeroxero

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?
 

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

Top