<div dir="ltr">Hi Ghislain and Mike,<div><br></div><div>Thank you for your replies, and thanks especially to Mike for tracking down the source of the problem I was having.  As indicated at <a href="https://saxonica.plan.io/issues/2789" target="_blank" style="font-size:12.8px">https://saxonica.plan.io/issues/2789</a>, a forthcoming maintenance release of Saxon will incorporate the fix.</div><div><br></div><div>In the meantime, I have a workaround - which has its own drawbacks.  Perhaps this is a pure XQuery question, and isn't Saxon-specific.  Here's the problem: If I remove the local:reconstruct() function, the XQuery Update operation works just fine, but all of the resulting interior nodes have an additional unwanted in-scope namespace declaration - see what happens to the source after transformation:</div><div><br></div><div>Source:</div><div><div>    <note xmlns="<a href="http://www.tei-c.org/ns/1.0">http://www.tei-c.org/ns/1.0</a>" xmlns:frus="<a href="http://history.state.gov/frus/ns/1.0">http://history.state.gov/frus/ns/1.0</a>"></div><div>        For text of NSC 164/1, see </div><div>        <ref></div><div>            <hi rend="italic">Foreign Relations,</hi> </div><div>            1952–1954, vol. VII, Part 2</div><div>        </ref>, p. 1914.</div><div>    </note></div></div><div><br></div><div>After transformation:</div><div><div>    <note xmlns="<a href="http://www.tei-c.org/ns/1.0">http://www.tei-c.org/ns/1.0</a>" xmlns:frus="<a href="http://history.state.gov/frus/ns/1.0">http://history.state.gov/frus/ns/1.0</a>"></div><div>        For text of NSC 164/1, see </div><div>        <ref></div><div>            <hi xmlns:frus="<a href="http://history.state.gov/frus/ns/1.0">http://history.state.gov/frus/ns/1.0</a>" rend="italic">Foreign Relations,</hi></div><div>            1952–1954, vol. VII, Part 2, p. 1914</div><div>        </ref>.</div><div>    </note></div></div><div><br></div><div>See the `xmlns:frus="<a href="http://history.state.gov/frus/ns/1.0">http://history.state.gov/frus/ns/1.0</a>"` bit?  This namespace is in scope for the whole document, so I don't want it to reappear each time I This didn't appear when I used local:reconstruct().  I couldn't figure out any way to suppress this from appearing, except my local:reconstruct() function, which triggered the Saxon bug.  I can clean this extra namespace declaration up via find and replace, but it would be ideal not to have to do this.</div><div><br></div><div>Is there a way to suppress the declaration of in-scope namespaces in the result?  I've posted a new gist with the updated code to demonstrate the issue: <a href="https://gist.github.com/joewiz/6092b1181cd53d9a5378aed369387bff">https://gist.github.com/joewiz/6092b1181cd53d9a5378aed369387bff</a>.</div><div><br></div><div>Thanks,</div><div>Joe</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 10, 2016 at 4:49 AM, Ghislain Fourny <span dir="ltr"><<a href="mailto:g@28.io" target="_blank">g@28.io</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">Hi Joe,<div><br></div><div>I agree with Mike. Also, I noticed that you are declaring your program as XQuery 3.0. As far as I know, the XQuery Update 3.0 specification is still a Working Draft ( <a href="https://www.w3.org/TR/xquery-update-30/" target="_blank">https://www.w3.org/TR/xquery-update-30/</a> ). I would advise proceeding with care if you combine new XQuery 3.0 constructs with updates.</div><div><br></div><div>Kind regards,</div><div>Ghislain</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Fri, Jun 10, 2016 at 10:39 AM, Michael Kay <span dir="ltr"><<a href="mailto:mike@saxonica.com" target="_blank">mike@saxonica.com</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>I've logged this as a Saxon issue here:</div><div><br></div><div><a href="https://saxonica.plan.io/issues/2789" target="_blank">https://saxonica.plan.io/issues/2789</a></div><div><br></div><div>and you can track progress on it there by registering and doing a "watch" (the icon for that in Redmine is a five-pointed star, as anyone would guess).</div><div><br></div><div>I'm afraid my first attempts threw up several different symptoms which may or may not turn out to be relevant to the problem that you experienced. As I mentioned, XQuery Update doesn't get exercised very much except for running the limited W3C test suite and a very small batch of unit tests when we make a release.</div><div><br></div><div>Michael Kay</div><div>Saxonica</div><div><br></div><br><div><blockquote type="cite"><span><div>On 9 Jun 2016, at 23:53, Joe Wicentowski <<a href="mailto:joewiz@gmail.com" target="_blank">joewiz@gmail.com</a>> wrote:</div><br></span><div><div><div><div dir="ltr">Hi all,<div><br></div><div>I'm struggling with an XQuery Update problem which is corrupting the file I'm trying to update.  I've posted my code samples to <a href="https://gist.github.com/joewiz/2369367de3babba30e0aad8c9beec893" target="_blank">https://gist.github.com/joewiz/2369367de3babba30e0aad8c9beec893</a> - but here's the core of the issue:</div><div><br></div><div><div>I'm working with a TEI document containing <ref> elements that I'm trying to manipulate with XQuery Update. Specifically, I'm grabbing a page number reference from the text node immediately following the <ref> element, and I want to move the page number inside the <ref> element. (I'm actually trying to do a few more things, but I've reduced the sample code to do just this, because it illustrates the problem I'm facing.)</div><div><br></div><div>The problem is that the XQuery Update statement corrupts my file. The resulting file has 0 bytes. When I comment out the XQuery Update statement and uncomment the $test variable in the return expression, I get expected results, so I think the logic is sound. I have a feeling that the problem may have to do with line 25, where I add attributes to an element; when I comment out this, the corruption doesn't occur. But I need the attributes in that line. So I'm stumped. I've never encountered data corruption with XQuery Update, so I really hope there's a solution.</div><div><br></div><div>I'm using Saxon-EE XQuery 9.6.0.7 inside of oXygen 17.1, with Saxon's options for XQuery 3.0 and XQuery Update enabled.</div></div><div><br></div><div>Many thanks for any suggestions,</div><div>Joe</div></div></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" target="_blank">http://x-query.com/mailman/listinfo/talk</a></div></blockquote></div><br></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>
</blockquote></div><br></div>