This looks like a straightforward XQuery coding question rather than something specific to Saxon. The preferred place for such questions is the mailing list talk@x-query.com.
 
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]
 

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay

 
 


From: Sweta Kedia [mailto:swetakedia@gmail.com]
Sent: 21 December 2009 14:47
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Help for getting distinct Values of attributes in nodesthrough xquery.

Hi,

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

<presentationLink xlink:role="http://www.biovail.com/2008-12-31/role/DocumentandEntityInformation" xlink:type="extended">
  <loc xlink:href="http://taxonomies.xbrl.us/us-gaap/2009/non-gaap/dei-2009-01-31.xsd#dei_EntityRegistrantName" 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="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="DocumentAndEntityInformationAbstract" xlink:to="EntityRegistrantName" xlink:title="presentation:DocumentAndEntityInformationAbstract to EntityRegistrantName" xlink:type="arc" />
  <loc xlink:href="http://taxonomies.xbrl.us/us-gaap/2009/non-gaap/dei-2009-01-31.xsd#dei_EntityCentralIndexKey" xlink:label="EntityCentralIndexKey" xlink:type="locator" />
  <presentationArc order="20" use="optional" xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child" xlink:from="DocumentAndEntityInformationAbstract" xlink:to="EntityCentralIndexKey" xlink:title="presentation:DocumentAndEntityInformationAbstract to EntityCentralIndexKey" xlink:type="arc" /> 
</presentationLink>

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.

Thanks

Sweta