Skip to content

Instantly share code, notes, and snippets.

@meau
Created August 28, 2014 18:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save meau/af5950bc9ba2f5f716e7 to your computer and use it in GitHub Desktop.
Find dates that restrictions will be lifted
xquery version "3.0";
declare namespace ead="urn:isbn:1-931666-22-9";
declare namespace xlink = "http://www.w3.org/1999/xlink";
declare namespace functx = "http://www.functx.com";
<restrictions>
{
for $ead in ead:ead
let $doc := base-uri($ead)
return
<document uri="{$doc}">
{
for $accessrestrict in $ead//ead:dsc//ead:accessrestrict/ead:p[matches(.,'(19|20)[0-9]{2}')]
let $series := $accessrestrict/ancestor::ead:c[@level = 'series' or @level = 'accession' or @level = 'accn']//ead:unitid
let $dateseg := fn:substring-after($accessrestrict,'until')
for $x in $series
return
<lookhere location="{$x}">
{$accessrestrict}
<date>{$dateseg}</date>
</lookhere>
}
</document>
}
</restrictions>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment