[xquery-talk] Can XQuery include the path to a node in it's answer?

Michael Kay mhk at mhk.me.uk
Sun Nov 28 23:15:52 PST 2004


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
http://www.dpawson.co.uk/xsl/sect2/N6077.html

If you're using Saxon, you can use the extension function saxon:path()

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> 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?
> 
> Hello,
> 
> 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?
> 
> For example,
> 
> If I say 
> 
> document("abc.xml")/site/catgraph/edge , 
> 
> 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
> do this?
> 
> Thanks,
> Padmapriya
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
> 



More information about the talk mailing list