[xquery-talk] Using a string parameter as path expression

Mathias Seifert SEIFERTM at de.ibm.com
Mon Feb 14 19:30:54 PST 2005


Hello,

I have a question for a rather simple task which I couldn't find any 
solution to. What I want to have is a function that takes an xpath as 
string parameter and then evaluates this xpath on a document. This could 
look something like the following:

declare function local:evalPath($path as xs:string) as node()
{
        let $a := doc("sample.xml")/$path
        return $a
}

Unfortunately I couldn't get this simple function to work, so my question 
now is: Is it possible with xquery at all to have a variable as the path 
expression of a for/let clause? And if so, how?

Thanks in advance.

Mathias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xquery.com/pipermail/talk/attachments/20050214/60843115/attachment.htm


More information about the talk mailing list