(: file: dt08_189_final.xq date: 07-Aug-2009 author: Gary Lewis purpose: Merges the XML with enrollment, unemployment rate, and recession data for the project addressing the question: Is higher education countercyclical? 1. Documentation is available at: http://garymlewis.com/instchg/public/xquery/dt08_189_doc.xq. Follow the steps in this documentation to Step 13. 2. Run the current program as follows (Step 13 in documentation): zorba -o dt08_189_final.xml -f -q dt08_189_final.xq -z indent=yes :) { let $tmp1 := for $year in doc("dt08_189_enrl.xml")/tabn189/year/@value let $enrl := doc("dt08_189_enrl.xml")/tabn189/year[@value = $year]/enrl, (: flatten out data structure :) $enrl_date := concat($year,'-','10-01'), $c2 := $enrl[@column = 2]/@pctchg, $c3 := $enrl[@column = 3]/@pctchg, $c4 := $enrl[@column = 4]/@pctchg, $c5 := $enrl[@column = 5]/@pctchg, $c6 := $enrl[@column = 6]/@pctchg, $c7 := $enrl[@column = 7]/@pctchg, $c8 := $enrl[@column = 8]/@pctchg, $c9 := $enrl[@column = 9]/@pctchg, $c10 := $enrl[@column = 10]/@pctchg, $c11 := $enrl[@column = 11]/@pctchg, $c12 := $enrl[@column = 12]/@pctchg, $c13 := $enrl[@column = 13]/@pctchg, $c14 := $enrl[@column = 14]/@pctchg, $c15 := $enrl[@column = 15]/@pctchg, $c16 := $enrl[@column = 16]/@pctchg return return let $tmp2 := for $j in doc("dt08_189_econ.xml")/time_series/series_date let $series_date := $j/@value, $k := $tmp1[@value = $series_date] return return $tmp2 }