On 15/11/2020 12:32, Ihe Onwuka wrote:
xquery version "3.1";

let $schemaCollection := "/db/apps/schemas"
 return collection($schemaCollection)/xs:schema/distinct-values(@targetNamespace)

does not eliminate duplicates

xquery version "3.1";

let $schemaCollection := "/db/apps/schemas"
 return collection($schemaCollection)/xs:schema/@targetNamespace => distinct-values()

does.

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.



_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk

distinct-values(@targetNamespace)


returns the input sequence with duplicates (by value) removed but @targetNamespace only selects at most one attribute so distinct-values will do nothing.

$schemaCollection)/xs:schema/@targetNamespace => distinct-values()

or

distinct-values($schemaCollection)/xs:schema/@targetNamespace)


here you first make the sequence of all the @targetNamespace then remove duplicates.


David

Disclaimer

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.

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.
_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk

Reply via email to