[xml] filtering a resulting NodeSet with xPath?



Hi!
I need to implement in a fast way the functionality of filter a nodeset (obtained applying an xPath to an XML), hopefully aplying a new xPath.
The xPath API only applies to and xmlDocPtr, not to and xmlNodeSetPtr...
The XMLs that i need to filter has as many as 100.000 nodes, therefore performence is a must!

Example

<root>
<elem id="0">1<elem>
<elem id="1">0<elem>
<elem id="0">0<elem>
</root>

First filter
/root/elem[ id="0"]

expected result:
<elem id="0">1<elem>
<elem id="0">0<elem>

Second filter
[.="1"]
<elem id="0">1<elem>


This is equivalent to make an XSL that saves the first nodeset in a variable (named for example "result") and apply
exsl:node-set($result)[.="1"]

Any advice?
Agustin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]