Skip to content

Instantly share code, notes, and snippets.

@CanOfBees
Last active June 3, 2021 18:08
Show Gist options
  • Save CanOfBees/bc1027b639de4bcad70f5d6144a51e37 to your computer and use it in GitHub Desktop.
Save CanOfBees/bc1027b639de4bcad70f5d6144a51e37 to your computer and use it in GitHub Desktop.
Validate MTSU_16
xquery version "3.1";
declare variable $oai-resp := fetch:xml("http://cdm15838.contentdm.oclc.org/oai/oai.php?verb=ListRecords&set=p15838coll16&metadataPrefix=oai_dc");
(: two items -
: 1. you'll want to add the saxon-8.7.jar to $BaseX/lib/custom, and,
: 2. you'll want to modify these paths if you want to double-check this
:)
declare variable $xslt := "/home/bridger/Documents/metadata-notes/DLTN/XSLT/mtsup15838coll16dctomods.xsl";
declare variable $schema := "/home/bridger/Documents/metadata-notes/DLTN/tests/testSchemas/DLTN_oai_mods.xsd";
$oai-resp => xslt:transform($xslt) => validate:xsd-report(file:read-text($schema)),
(: alternate method :)
file:write(
"/tmp/mtsu_16.oai.xml",
$oai-resp,
map {"method": "xml" }
),
file:write(
"/tmp/mtsu_16.transformed.xml",
xslt:transform("/tmp/mtsu_16.oai.xml", $xslt),
map { "method": "xml" }
),
proc:execute(
"xmllint", ("--noout", "--schema", $schema, "/tmp/mtsu_16.transformed.xml")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment