<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">.style1 {font-family: "Times New Roman";}</style></head><body>
<div class="moz-cite-prefix">On 15/11/2020 12:32, Ihe Onwuka wrote:<br>
</div>
<blockquote type="cite" cite="mid:CALfs7+x4eEeiSqOr-99X3n48kU4JuwZhh74my2n-12Pa_myJ-Q@mail.gmail.com">
<div dir="ltr">xquery version "3.1";<br>
<br>
let $schemaCollection := "/db/apps/schemas"<br>
return
collection($schemaCollection)/xs:schema/distinct-values(@targetNamespace)<br>
<div><br>
</div>
<div>does not eliminate duplicates</div>
<div><br>
</div>
<div>xquery version "3.1";<br>
<br>
let $schemaCollection := "/db/apps/schemas"<br>
return
collection($schemaCollection)/xs:schema/@targetNamespace =>
distinct-values()<br>
</div>
<div><br>
</div>
<div>does.</div>
<div><br>
</div>
<div>I checked this in Saxon and exist-db XQuery, both return
the same results so this may be how it's supposed to work but
I don't get it. </div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:talk@x-query.com">talk@x-query.com</a>
<a class="moz-txt-link-freetext" href="http://x-query.com/mailman/listinfo/talk">http://x-query.com/mailman/listinfo/talk</a></pre>
</blockquote>
<p>distinct-values(@targetNamespace)</p>
<p><br>
</p>
<p>returns the input sequence with duplicates (by value) removed but
@targetNamespace only selects at most one attribute so
distinct-values will do nothing.</p>
<p>$schemaCollection)/xs:schema/@targetNamespace =>
distinct-values()</p>
<p>or</p>
<p>distinct-values($schemaCollection)/xs:schema/@targetNamespace)</p>
<p><br>
</p>
<p>here you first make the sequence of all the @targetNamespace then
remove duplicates.</p>
<p><br>
</p>
<p>David</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<br><br><p style="font-family: Verdana; font-size:10pt; color:#666666;"><b>Disclaimer</b></p><p style="font-family: Verdana; font-size:8pt; color:#666666;">The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. Please see our <A href="https://www.nag.co.uk/content/privacy-notice">Privacy Notice</A> for information on how we process personal data and for details of how to stop or limit communications from us.<br><br>This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.</p>
</body></html>