[xquery-talk] Can XQuery include the path to a node in
jhunter at xquery.com
Sun Nov 28 23:49:34 PST 2004
In Mark Logic you can use xdmp:describe(). The function actually takes
any argument (node, sequence, query object) and outputs a helpful
description. For node types it returns the XPath (including the
appropriate doc() call if any).
The path()/describe() and eval() functions are going to be implemented
by any vendor having to solve problems in the real world. They're just
You could write a portable describe() for node types if you wanted. It
would make a good class lab. Get the document URI, walk the ancestors,
and count the preceding same-named siblings for positional predicates.
Michael Kay wrote:
> There is no built-in function that gets the path to a node. (One reason is
> that for any node, there are many paths that reach it).
> You'll find some XSLT solutions to this problem, which readily translate to
> equivalent XQuery expressions, at
> If you're using Saxon, you can use the extension function saxon:path()
> Michael Kay
>>From: talk-bounces at xquery.com
>>[mailto:talk-bounces at xquery.com] On Behalf Of padmapriya ayyagari
>>Sent: 28 November 2004 22:00
>>To: talk at xquery.com
>>Subject: [xquery-talk] Can XQuery include the path to a node
>>in it's answer?
>>Could someone please tell me how to write an XQuery for getting the
>>values for a given node in the document and also the whole path for
>>that node in the answer to the XQuery?
>>If I say
>>then XQuery simply returns the answer but does not include the path
>>/site/catgraph/edge in the answer. Could someone please tell me how to
>>talk at xquery.com
> talk at xquery.com
More information about the talk