(: file: find_duplicate_unitids.xq date: 11-May-2010 author: Gary Lewis purpose: Identify the IPEDS unitids that appear more than once in the directory data files. usage: Program should be run from directory in which it is located. The XML data filename should include the path relative to program. example: zorba -e xml_filename:="../1986/IC1986_A/ic1986_a.xml" -f -q find_duplicate_unitids.xq -z indent=yes :) declare variable $xml_filename external; { let $tmp1 := for $x in fn:doc($xml_filename)/data/record let $unitid := $x/@unitid, $cnt := 1 group by $unitid order by $unitid return return let $tmp2 := for $y in $tmp1 let $unitid := $y/@unitid, $count := $y/@count where $count > 1 order by $count descending, $unitid return return $tmp2 }