<div dir="ltr">Hi all,<div><br></div><div>Have there been any further developments in the area of unwanted reformatting of entire documents after applying XQuery Update operations to just a portion of a document?  I'm using oXygen 18.1 with Saxon-EE XQuery 9.6.0.7, with "Strip whitespaces" set to "None ("none")", XQuery 3.0 support enabled, and XQuery Update enabled.</div><div><br></div><div>For example, lines 1-2 of the source document began as this:</div><div><br></div><div><div><?xml version="1.0" encoding="UTF-8"?></div><div><TEI 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>" xml:id="frus1969-76v36"></div></div><div><br></div><div>But after running the XQuery Update, these two lines are now merged onto a single line:</div><div><br></div><div><div><?xml version="1.0" encoding="UTF-8"?><TEI 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>" xml:id="frus1969-76v36"></div></div><div><br></div><div>As you can imagine, this wreaks havoc with diff tools, so I would like to find a way, if possible, to limit the scope of whitespace changes to just where the query applies updates.  </div><div><br></div><div>Apologies if this turns out to be a product-specific question, but I'm not quite sure how to distinguish in this question between XQuery Update, Saxon, and oXygen.</div><div><br></div><div>Thank you,</div><div>Joe</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 10, 2012 at 4:00 AM, Michael Kay <span dir="ltr"><<a href="mailto:mike@saxonica.com" target="_blank">mike@saxonica.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Andrew has answered the whitespace questions.<br>
<br>
It's a Saxon (not an Oxygen) restriction that XQuery 3.0 and XQuery Update can't currently be used together in the same query. It happened that way because both are implemented as extensions to the "core" XQuery 1.0 parser, built using subclassing. (Done that way partly because of the code separation between different Saxon editions). We need to fix this mechanism, which is becoming pretty unmanageable with the number of different language dialects supported. Ideally, I suppose, we should make a complete break and move to a bottom-up table driven parser; but XQuery parsing is so fragile with the number of context-dependent decisions that need to be made, it's a risky change to contemplate.<br>
<br>
Michael Kay<br>
Saxonica<div><div class="h5"><br>
<br>
On 09/07/2012 19:45, Joe Wicentowski 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">
Hi all,<br>
<br>
I'm having a problem with query I wrote that makes use of the XQuery<br>
Update Facility.  The problem is that unwanted whitespace inserted<br>
into the results of my query.  Here is my source XML (a TEI-like<br>
list), the query in question, and the output showing the unwanted<br>
whitespace:<br>
<br>
source.xml:<br>
-----------------<br>
<list><br>
     <item>See <ref target="#MIDDLEEAST">Middle East</ref></item><br>
     <item xml:id="MIDDLEEAST">Middle East <ref target="#d68">68</ref></item><br>
</list><br>
<br>
fix-ids.xq:<br>
--------------<br>
let $doc := doc('source.xml')<br>
for $item-id at $count in $doc//item/@xml:id<br>
let $new-id := concat('in', $count)<br>
let $new-target := concat('#', $new-id)<br>
let $targets := $doc//ref[@target = concat('#', $item-id)]/@target<br>
return<br>
     (<br>
     (: fix @xml:ids :)<br>
     replace value of node $item-id with $new-id<br>
     ,<br>
     (: fix @targets :)<br>
     for $target in $targets<br>
     return<br>
         replace value of node $target with $new-target<br>
     )<br>
<br>
output:<br>
----------<br>
<list><br>
    <item>See <ref target="#in1">Middle East</ref><br>
    </item><br>
    <item xml:id="in1">Middle East <ref target="#d68">68</ref><br>
    </item><br>
</list><br>
<br>
Note that while the query only modifies attribute values, the results<br>
of the query are somehow re-indented.  (Specifically, in the source,<br>
there was no whitespace between </ref> and </item>, but in the<br>
results, </item> is on a new line.<br>
<br>
Is this a serialization issue?  Is there a way for me to declare some<br>
options that will prevent the unwanted whitespace from being inserted?<br>
<br>
I'm not sure whether this is a general XQuery issue or an<br>
implementation-specific issue, so let me know if this isn't the right<br>
forum for this question.  I'm using oXygen 13 in XQuery Debugger mode<br>
with Saxon EE-XQuery 9.3.0.5.<br>
<br>
(On a related note, I see that XQuery 3.0 has new support for<br>
serialization options --<br>
<a href="http://www.w3.org/TR/xquery-30/#id-serialization" rel="noreferrer" target="_blank">http://www.w3.org/TR/xquery-30<wbr>/#id-serialization</a> -- but oXygen doesn't<br>
seem to allow combining XQuery 3.0 with XQuery Update Facility and<br>
Saxon EE.  This forum post instructs users to disable XQuery 1.1/3.0<br>
support in order to use XQUF:<br>
<a href="http://www.oxygenxml.com/forum/topic6615.html" rel="noreferrer" target="_blank">http://www.oxygenxml.com/forum<wbr>/topic6615.html</a>.)<br>
<br>
Thanks,<br>
Joe<br></div></div>
______________________________<wbr>_________________<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/lis<wbr>tinfo/talk</a><br>
<br>
</blockquote>
<br>
<br>
______________________________<wbr>_________________<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/lis<wbr>tinfo/talk</a><br>
</blockquote></div><br></div>