Fw: [xml] filtering a resulting NodeSet with xPath?



It seems that I failed to obtain any attention from the xml gurus... The I must try again.

My doubt is :
- I don't undestand how libxslt implements its capacity of apply a xpath's query over a nodeset (even if this last is a result of another nodeset), since don't exists any API (in xpath.c) that allows to do so. Does the gurus have any pointer to a way to implement this functionality without using an XSLT transformation? Mabye ...

xmlNodeSetPtr nodeSet = evalXpath(doc,"//a");
xmlNodeSetPtr refinedNodeSet = evalXpath(nodeSet,"[ id='3']");

Thank for any help

Agustin

----- Original Message ----- From: "Agustín Villena" <avillena tutopia com>
To: <>
Sent: Monday, November 22, 2004 9:51 AM
Subject: [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
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




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