[xquery-talk] Problem with "let" statements in an xquery function

Ignacio Tripodi ignaciot at gmail.com
Tue Aug 12 17:45:43 PDT 2008


Hi,

I'm puzzled about this function I'm working on:

declare updating function
       do_stuff
(
       $a as element(),
       $b as xs:string
)
{
       let $c := $a//some_element[.=$b]/..[another_elem='foo']
       let $d := $a//anoher/element

       return
       if( exists($c) )
       then
               replace value of node $c/xxx with $d
       else
               ()
};

The problem is, those "let" statements aren't working... if I check the
value of $c or $d they're null. And the xpath expression I'm using is valid.
Based on the W3 specs I understand those "let" declarations are valid:

http://www.w3.org/TR/2008/CR-xquery-update-10-20080801/#doc-xquery-FunctionDecl

What am I missing? Should I assign those variables in some other way? I
tried using "declare variable" instead but that didn't work either.
Thanks for any comments, I think I could use an extra pair of eyes. :-)

-i
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20080812/74832af0/attachment.htm


More information about the talk mailing list