How are you proposing to do the "remove from the original document" step?
Saxon does not have a native tree structure that supports in-situ update.
You could use a DOM or JDOM: in that case, the result of the XPath
expression will be a JDOM or DOM node, and the problem of remembering the
node identity becomes a JDOM or DOM problem, because you will be using JDOM
or DOM interfaces to do the update.
The NodeInfo interface has a method to return an identifier that's unique
within the document, and for most implementations you'll get the same
identifiers each time you parse the document, but there's no mechanism for
going back to the node given this identifier.
> -----Original Message-----
> From: saxon-help-admin@...
> [mailto:saxon-help-admin@...] On Behalf Of
> Arnaud SAHUGUET
> Sent: 14 May 2004 14:59
> To: saxon-help@...
> Subject: [saxon] access to node identity in Saxon
> I would like to take advantage of the Saxon XPath API to do
> the following:
> - take an XML document D
> - parse D
> - evaluate XPath expression e1 on D, get back a nodeset and mark the
> returned nodes
> - evaluate XPath expression e2 on D, get back a nodeset and mark the
> returned nodes
> - etc.
> - maybe mark some other nodes (e.g. ancestors of marked nodes or
> - remove from the original document the nodes that have not
> been marked
> Are nodes given a node identity that be reused consistently?
> |*generateId <cid:part1.02010701.04050908@...>*() seems to be
> doing that.|
> If I parse the same document twice, will nodes have the same
> node identity?
> In Apache Xerces, the implementation has a getIndex method that does
> exactly that. The index corresponds to the order in the document tree.
> This SF.Net email is sponsored by: SourceForge.net Broadband
> Sign-up now for SourceForge Broadband and get the fastest
> 6.0/768 connection for only $19.95/mo for the first 3 months!
> saxon-help mailing list