(: OBSOLETED! date: 27-August-2010 author: Gary Lewis note: whPop.xml now contains all IPEDS institutions rather than the 5602 that appear in Table 265. This provides greater long-term flexibility in population definition. An indicator variable in whPop.xml will identify the 5602. :) (: file: gen_whPop.xq date: 30-July-2010 author: Gary Lewis purpose: Uses the 5602 institutions in pop_distinct_institutions.xml to populate one XML with each of the 25 years of IPEDS data. For example, the 2008-09 survey has 4530 of the 5602 institutions, while the 1980-81 survey has 3092 of the 5602 institutions. The output XML (whPop.xml) can then be updated with year specific data on each institution. usage: Run the program from the path where it is located. example: zorba -f -q gen_whPop.xq -o whPop.xml -z indent=yes revision history date: 04-August-2010 author: Gary Lewis revised: 1. Replaced with to better distinguish from the use of in other XML (eg, pop_all_years.xml). The population in these other XML refers to the institutions in Table 265 of the NCES Digest of Education Statistics 2009 for each year. The population in the present program refers to the 5602 distinct institutions that ever appeared in Table 265 in any of the 25 years of data. This population is now called the "warehouse population". Hence the meaning for . :) { for $x in fn:doc("../xml/metadata/ipedsData.xml")/data/file[@type = "xml"] let $year := xs:integer($x/@year), $xmlFile := concat($x/@path, $x/@name) order by $year descending return { let $i := fn:doc("../xml/warehouse/pop_distinct_institutions.xml")/population/inst/@unitid, $j := fn:doc($xmlFile)/data/record/@unitid for $k in ($i[.=$j]) return } }