Skip to content

Instantly share code, notes, and snippets.

@dmj
Created March 20, 2021 19:32
Show Gist options
  • Save dmj/664601968fbc3f55423fa52e4bcbfe36 to your computer and use it in GitHub Desktop.
Save dmj/664601968fbc3f55423fa52e4bcbfe36 to your computer and use it in GitHub Desktop.
A streaming Schematron
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt3"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<sch:ns prefix="mets" uri="http://www.loc.gov/METS/"/>
<sch:ns prefix="oai" uri="http://www.openarchives.org/OAI/2.0/"/>
<sch:ns prefix="xs" uri="http://www.w3.org/2001/XMLSchema"/>
<xsl:accumulator name="recordId" streamable="yes" initial-value="()" as="xs:string?">
<xsl:accumulator-rule match="oai:identifier/text()" select="."/>
</xsl:accumulator>
<sch:pattern>
<sch:rule context="mets:fileSec" streaming="true" burst="snapshot">
<sch:report test="mets:fileGrp[@USE = 'ZOOM']">IIIF-Interface for record <sch:value-of select="accumulator-after('recordId')"/></sch:report>
</sch:rule>
</sch:pattern>
</sch:schema>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment