(: file: gen_ipedsVars_metadata.xq date: 30-June-2010 author: Gary Lewis purpose: This program uses variable metadata in ipedsVars_fmt_lbl.xml to produce ipedsVars_metadata.xml. Metadata includes: variable name, year, datatype, field width, description, and number of years that the variable appeared in IPEDS surveys. notes: 1. Run this after having run gen_ipedsVars_fmt_lbl.pl to create ipedsVars_fmt_lbl.xml. use: Run program from path where it is located. example: zorba -f -q gen_ipedsVars_metadata.xq -o /home/gml/rwebdb/projects/ipeds/xml/metadata/ipedsVars_metadata.xml -z indent=yes :) (: revision history: date: 12-July-2010 author: Gary Lewis revised: 1. To include the name of the SPS file used to source the metadata. :) { for $name in fn:doc("/home/gml/rwebdb/projects/ipeds/xml/metadata/ipedsVars_fmt_lbl.xml")/variables/var/@name let $cnt := 1 group by $name order by $name return { for $j in fn:doc("/home/gml/rwebdb/projects/ipeds/xml/metadata/ipedsVars_fmt_lbl.xml")/variables/var[@name = $name] let $year := $j/@year, $dataType := $j/@datatype, $fieldWidth := $j/@width, $desc := $j/@description, $src := $j/@source order by $year return } }