<div dir="ltr">Hi,<br><br>I&#39;m puzzled about this function I&#39;m working on:<br><br>declare updating function<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do_stuff<br>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a as element(),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $b as xs:string<br>)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; let $c := $a//some_element[.=$b]/..[another_elem=&#39;foo&#39;]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; let $d := $a//anoher/element<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( exists($c) )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; replace value of node $c/xxx with $d<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ()<br>};<br><br>The problem is, those &quot;let&quot; statements aren&#39;t working... if I check the value of $c or $d they&#39;re null. And the xpath expression I&#39;m using is valid. Based on the W3 specs I understand those &quot;let&quot; declarations are valid:<br>
<br><a href="http://www.w3.org/TR/2008/CR-xquery-update-10-20080801/#doc-xquery-FunctionDecl">http://www.w3.org/TR/2008/CR-xquery-update-10-20080801/#doc-xquery-FunctionDecl</a><br><br>What am I missing? Should I assign those variables in some other way? I tried using &quot;declare variable&quot; instead but that didn&#39;t work either.<br>
Thanks for any comments, I think I could use an extra pair of eyes. :-)<br><br>-i<br><br><br><br></div>