Skip to content

Instantly share code, notes, and snippets.

@meau
Created July 24, 2014 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meau/98d2db7463de6fe4bc96 to your computer and use it in GitHub Desktop.
Save meau/98d2db7463de6fe4bc96 to your computer and use it in GitHub Desktop.
Which boxes in which collections have a "Folder 1"?
xquery version "1.0";
declare namespace ead="urn:isbn:1-931666-22-9";
declare namespace xlink = "http://www.w3.org/1999/xlink";
<root>
{
for $ead in ead:ead
let $doc := base-uri($ead)
return
<document uri="{$doc}">
{
for $ead in $ead
let $box := $ead/(//ead:container[@type="Box"])
let $folder1 := $box/following-sibling::ead:container[@type ="Folder"][. eq "1"]
let $boxbelong := $folder1/preceding-sibling::ead:container[@type ="Box"]
return
$boxbelong
}
</document>
}
</root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment