[xquery-talk] Using axis in XQuery

Ivan Pedruzzi ipedruzz at progress.com
Wed Dec 1 03:34:40 PST 2004


This is one way

declare function local:fullpath($node as node())
{
	if (name($node)) then 
		concat(name($node), '/', local:fullpath($node/..))
	else ()
};

Ivan


> -----Original Message-----
> From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On
Behalf Of padmapriya ayyagari
> Sent: Tuesday, November 30, 2004 10:06 PM
> To: talk at xquery.com
> Subject: [xquery-talk] Using axis in XQuery
> 
> Hello,
> 
> The code given below provides an xslt solution for printing the path
to a node.
> However, I could not find how to use the axis (equivalent of 'select'
> given below) in xquery.
> 
> I need a function such that : For every node returned as an answer to
> an xquery which is a union of xqueries, I want the path from the root
> to that node in the document.
> 
> <xsl:for-each select="ancestor-or-self::*">
>   <xsl:text>/</xsl:text>
>   <xsl:value-of select="name()" />
> </xsl:for-each>
> 
> Also, between galax and saxon, which would you suggest for running
> xqueries on xml documents?
> 
> Thank you so much Micahel and Jason for helping me out.
> 
> Padmapriya
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk




More information about the talk mailing list