<div dir="ltr">Hi Leo, Joseph,<div><br></div><div>Actually, the semantics of the XQuery Update Facility is based on snapshots, which means that the order of the expressions is irrelevant in terms of updates. Each expression is evaluated against the original document, gathering a set of updates known as a PUL, and the updates are only applied at the very end.</div><div><br></div><div>Even with the delete coming first, the insert still should see the to-be-deleted node. Even if you swap the two expressions, the engine may still evaluate the second expression first under the hood, or even in parallel, and you won't see any difference. Commas have a monoid (concatenation) semantics when used with items, but no elapse-of-time semantics.</div><div><br></div><div>The XQuery Update Facility , like XQuery was very cleanly designed as a declarative language :-)</div><div><br></div><div>I hope it's useful.</div><div><br></div><div>Kind regards,<br></div><div>Ghislain</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 6, 2015 at 6:54 PM, Joseph Bryan <span dir="ltr"><<a href="mailto:joemfb@gmail.com" target="_blank">joemfb@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Leo,</div><div><br></div>Try reversing the order of your statements, first inserting the node as a child of <b/> before deleting it.<div><br></div><div>Also, you probably don't want to be using // in your selectors, which means the descendant-or-self axis. With that XPath expression, any @att at any level of the document would be copied and then deleted. Instead, use exact paths with a single /, which is the child axis.</div><div><br></div><div><div>insert node doc("xml.xml")/a/@att into doc("xml.xml")/a/b,<br></div><div>delete node doc("xml.xml")/a/@att</div></div><div><br></div><div>Thanks.</div><div><br></div><div>-jb</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Oct 6, 2015 at 12:23 PM, Leo Studer <span dir="ltr"><<a href="mailto:leo.studer@varioweb.ch" target="_blank">leo.studer@varioweb.ch</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div style="word-wrap:break-word"><div>Hello</div><div><br></div><div>I am using Oxygen 17.0 with Saxon EE 9.6.0.5 as the xQuery Update processor.</div><div><br></div><div>I want to move an attribute one level deeper.</div><div><br></div><div>In the example I want to move <span style="color:rgb(249,151,94)">att</span><span style="color:rgb(255,148,80)">=</span><span style="color:rgb(171,69,0)">"att</span><font color="#ab4500">”</font> from <span style="color:rgb(2,29,167)"><a></span> to <span style="color:rgb(2,29,167)"><b></span></div><div><br></div><div><div style="margin:0px;color:rgb(158,68,211)"><?xml version="1.0" encoding="UTF-8"?><span style="color:#000000"><br>
</span><span style="color:#021da7"><a</span><span style="color:#f9975e"> att</span><span style="color:#ff9450">=</span><span style="color:#ab4500">"att"</span><span style="color:#021da7">></span><span style="color:#000000"><br>
    </span><span style="color:#021da7"><b/></span><span style="color:#000000"><br>
</span><span style="color:#021da7"></a></span></div></div><div style="margin:0px;color:rgb(158,68,211)"><span style="color:#021da7"><br></span></div><div style="margin:0px;color:rgb(158,68,211)"><span style="color:#021da7">Here my code:</span></div><div style="margin:0px;color:rgb(158,68,211)"><span style="color:#021da7"><br></span></div><div style="margin:0px;color:rgb(158,68,211)"><div style="margin:0px;color:rgb(66,72,167)"><span style="color:#00a7d2"><b>delete</b></span><span style="color:#000000"> </span><span style="color:#00a7d2"><b>node</b></span><span style="color:#000000"> </span><span style="color:#004f00"><i>doc</i></span><span style="color:#000000">(</span>"xml.xml"<span style="color:#000000">)</span><span style="color:#8b8900">//</span><span style="color:#f59557"><b><i>@att</i></b></span><span style="color:#8b8900">,</span><span style="color:#000000"><br>
</span><span style="color:#00a7d2"><b>insert</b></span><span style="color:#000000"> </span><span style="color:#00a7d2"><b>node</b></span><span style="color:#000000"> </span><span style="color:#004f00"><i>doc</i></span><span style="color:#000000">(</span>"xml.xml"<span style="color:#000000">)</span><span style="color:#8b8900">//</span><span style="color:#f59557"><b><i>@att</i></b></span><span style="color:#000000"> </span><span style="color:#00a7d2"><b>into </b></span><span style="color:#004f00"><i>doc</i></span><span style="color:#000000">(</span>"xml.xml"<span style="color:#000000">)</span><span style="color:#8b8900">//</span><span style="color:#042eeb"><b>b</b></span></div></div><div><br></div><div>Each of these two statements work correctly alone but when I try both together I get java.lang.NullPointerException.</div><div><br></div><div>Can anyone explain what happens here?</div><div><br></div><div>Thanks in advance</div><span><font color="#888888"><div>Leo</div><div><br></div><div><br></div><br>
<br></font></span></div><br></div></div>_______________________________________________<br>
<a href="mailto:talk@x-query.com" target="_blank">talk@x-query.com</a><br>
<a href="http://x-query.com/mailman/listinfo/talk" rel="noreferrer" target="_blank">http://x-query.com/mailman/listinfo/talk</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
<a href="mailto:talk@x-query.com">talk@x-query.com</a><br>
<a href="http://x-query.com/mailman/listinfo/talk" rel="noreferrer" target="_blank">http://x-query.com/mailman/listinfo/talk</a><br></blockquote></div><br></div>