(: file: gen_ipedsVars.xq date: 10-June-2010 author: Gary Lewis purpose: Generates an xml file called ipedsVars.xml that contains metadata on IPEDS variables. use: Run program from its location. notes: 1. At present only IPEDS directory data files get included. As more data files is downloaded from the IPEDS web site, these too can be handled in the program with only minor variation. example: zorba -f -q gen_ipedsVars.xq -o "../xml/metadata/ipedsVars.xml" -z indent=yes :) { for $m in ( for $i in fn:doc("/home/gml/rwebdb/projects/ipeds/xml/metadata/ipedsData.xml")/data/file[@type = "xml"] for $j in fn:doc("/home/gml/rwebdb/projects/ipeds/xml/metadata/ipedsFiles.xml")/ipedsFiles/file[@dir_ind = "1"] let $name := $i/@name, $path := $i/@path, $xmlFile := concat($path, $name), $name_wo_ext := substring-before($name, "."), $csvName := $j/@csvName, $year := $j/@year where $csvName = $name_wo_ext order by $year return ) return let $year := $m/@year for $n in fn:doc($m/@xmlFile)/data/record[1]/@* return }