[xquery-talk] Problem with "let" statements in an xquery function
Andrew Welch
andrew.j.welch at gmail.com
Wed Aug 13 12:20:47 PDT 2008
2008/8/12 Ignacio Tripodi <ignaciot at gmail.com>:
> 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.
$a//some_element[.=$b]/..[another_elem='foo']
That line is almost certainly the problem... what are you trying to do there?
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
More information about the talk
mailing list