[xquery-talk] Absolute Path of Node

EXTERNAL Kruse Peter (Praktikant; CR/AEF4) external.Peter.Kruse at de.bosch.com
Mon May 30 17:04:49 PDT 2005


Hi folks,

I was searching the archives but i can't find a straight forward solution for my problem. Please excuse if it already exists and i simply didn't find it.

Part 1: After doing a "let" or a "for" with //, is it posible to get the path from the root-node to the selected node? Maybe as string?

Like in this example:
---------------
let $anydepth := doc("file.xml")//somepath
for $element in $anydepth/special/*
  return
    {fn:path-from-root($element)}
---------------
I know the function path-from-root does not exist but is there something similar?

Part 2: I'd like to compare absolute pathes of two (or more) different nodes. So if one has a path like
/a/b/c/d 
and the other has
/a/b/e/f
Is it possible, to make b the current node and do operations on it and its children? Something like nearest common ancestor? There had been discussions on the xsl lists but is there a xquery/xpath only solution?


Mit freundlichen Grüßen / Kind Regards,
Peter Kruse

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xquery.com/pipermail/talk/attachments/20050530/c507f7a3/attachment.htm


More information about the talk mailing list