This looks like a straightforward XQuery coding question rather than something specific to Saxon. The preferred place for such questions is the mailing list
You can determine whether there are any duplicates using the test (count(.//@order) = count(distinct-values(.//@order)).  If this shows there is a problem (duplicates present) then you can locate and report on the duplicates using
presentationArc[@order = preceding-sibling::presentationArc/@order]


Michael Kay


From: Sweta Kedia []
Sent: 21 December 2009 14:47
Subject: [saxon] Help for getting distinct Values of attributes in nodesthrough xquery.


I am trying to retirieve distinct values of attributes through xquery in Saxonica  . Sample xml is as follows:

<presentationLink xlink:role="" xlink:type="extended">
  <loc xlink:href="" xlink:label="EntityRegistrantName" xlink:type="locator" />
  <loc xlink:href="bvf-20081231.xsd#bvf_DocumentAndEntityInformationAbstract" xlink:label="DocumentAndEntityInformationAbstract" xlink:type="locator" />
  <presentationArc order="10" use="optional" xlink:arcrole="" xlink:from="DocumentAndEntityInformationAbstract" xlink:to="EntityRegistrantName" xlink:title="presentation:DocumentAndEntityInformationAbstract to EntityRegistrantName" xlink:type="arc" />
  <loc xlink:href="" xlink:label="EntityCentralIndexKey" xlink:type="locator" />
  <presentationArc order="20" use="optional" xlink:arcrole="" xlink:from="DocumentAndEntityInformationAbstract" xlink:to="EntityCentralIndexKey" xlink:title="presentation:DocumentAndEntityInformationAbstract to EntityCentralIndexKey" xlink:type="arc" /> 

For each presentationLink i want to find out presentationArc  which has duplicate values of @order attribute and the corresponding line number, for each i have to give duplicate order value error.

Please suggest how can I do this.