+=head2 $format_to_stylesheet_map
+
+This hashref of hashrefs maps from a MARC flavour and unAPI format
+to the stylesheet that should be used to transform the bib MARCXML
+to the desired output format. As new MARC XSLT stylesheets are added,
+(particularly for UNIMARC), this map should be updated. Of course,
+if/when we add support for emitting a format that is not genreated
+by a stylesheet, the structure of this variable will have to be changed.
+At present, this doubles as the list of output formats supported by
+this unAPI implementation.
+
+=cut
+
+my $format_to_stylesheet_map = {
+ 'MARC21' => {
+ 'marcxml' => 'identity.xsl',
+ 'marcxml-full' => 'identity.xsl',
+ 'mods' => 'MARC21slim2MODS.xsl',
+ 'mods-full' => 'MARC21slim2MODS.xsl',
+ 'mods3' => 'MARC21slim2MODS3-1.xsl',
+ 'mods3-full' => 'MARC21slim2MODS3-1.xsl',
+ 'oai_dc' => 'MARC21slim2OAIDC.xsl',
+ 'rdfdc', => 'MARC21slim2RDFDC.xsl',
+ 'rss2' => 'MARC21slim2RSS2.xsl',
+ 'rss2-full' => 'MARC21slim2RSS2.xsl',
+ 'srw_dc' => 'MARC21slim2SRWDC.xsl',
+ },
+ 'NORMARC' => {
+ 'marcxml' => 'identity.xsl',
+ 'marcxml-full' => 'identity.xsl',
+ 'mods' => 'MARC21slim2MODS.xsl',
+ 'mods-full' => 'MARC21slim2MODS.xsl',
+ 'mods3' => 'MARC21slim2MODS3-1.xsl',
+ 'mods3-full' => 'MARC21slim2MODS3-1.xsl',
+ 'oai_dc' => 'MARC21slim2OAIDC.xsl',
+ 'rdfdc', => 'MARC21slim2RDFDC.xsl',
+ 'rss2' => 'MARC21slim2RSS2.xsl',
+ 'rss2-full' => 'MARC21slim2RSS2.xsl',
+ 'srw_dc' => 'MARC21slim2SRWDC.xsl',
+ },
+ 'UNIMARC' => {
+ 'marcxml' => 'identity.xsl',
+ 'marcxml-full' => 'identity.xsl',
+ 'oai_dc' => 'UNIMARCslim2OAIDC.xsl',
+ },
+};
+
+=head2 $format_info
+
+This hashref maps from unAPI output formats to the <format> elements
+used to describe them in an unAPI format request.
+
+=cut
+
+my $format_info = {
+ 'marcxml' => q(<format name="marcxml" type="application/xml" namespace_uri="http://www.loc.gov/MARC21/slim" docs="http://www.loc.gov/marcxml/" schema_location="http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"/>),
+ 'marcxml-full' => q(<format name="marcxml-full" type="application/xml" namespace_uri="http://www.loc.gov/MARC21/slim" docs="http://www.loc.gov/marcxml/" schema_location="http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"/>),
+ 'mods' => q(<format name="mods" type="application/xml" namespace_uri="http://www.loc.gov/mods/" docs="http://www.loc.gov/mods/" schema_location="http://www.loc.gov/standards/mods/mods.xsd"/>),
+ 'mods-full' => q(<format name="mods-full" type="application/xml" namespace_uri="http://www.loc.gov/mods/" docs="http://www.loc.gov/mods/" schema_location="http://www.loc.gov/standards/mods/mods.xsd"/>),
+ 'mods3' => q(<format name="mods3" type="application/xml" namespace_uri="http://www.loc.gov/mods/v3" docs="http://www.loc.gov/mods/" schema_location="http://www.loc.gov/standards/mods/v3/mods-3-1.xsd"/>),
+ 'mods3-full' => q(<format name="mods3-full" type="application/xml" namespace_uri="http://www.loc.gov/mods/v3" docs="http://www.loc.gov/mods/" schema_location="http://www.loc.gov/standards/mods/v3/mods-3-1.xsd"/>),
+ 'oai_dc' => q(<format name="oai_dc" type="application/xml" namespace_uri="http://www.openarchives.org/OAI/2.0/oai_dc/" schema_location="http://www.openarchives.org/OAI/2.0/oai_dc.xsd"/>),
+ 'rdfdc' => q(<format name="rdfdc" type="application/xml" namespace_uri="http://purl.org/dc/elements/1.1/" schema_location="http://purl.org/dc/elements/1.1/"/>),
+ 'rss2' => q(<format name="rss2" type="application/xml"/>),
+ 'rss2-full' => q(<format name="rss2-full" type="application/xml"/>),
+ 'srw_dc' => q(<format name="srw_dc" type="application/xml" namespace_uri="info:srw/schema/1/dc-schema" schema_location="http://www.loc.gov/z3950/agency/zing/srw/dc-schema.xsd"/>),
+};
+
+my $id = $cgi->param('id');