Skip to content

Instantly share code, notes, and snippets.

@kschlottmann
Last active February 5, 2019 12:45
Show Gist options
  • Select an option

  • Save kschlottmann/1a21c9c6587ef4d81e34970087db7691 to your computer and use it in GitHub Desktop.

Select an option

Save kschlottmann/1a21c9c6587ef4d81e34970087db7691 to your computer and use it in GitHub Desktop.
xquery to find EAD did elements without unittitle or unitdate
<data>
{
for $Record in /ead
where $Record/archdesc/dsc//did/unitdate[not(normalize-space(.))]
let $id := $Record/archdesc/did/unitid[@type='clio']/text()
let $repo := $Record/archdesc/did/unitid[1]/@repositorycode
let $didEmptyTitle := $Record/archdesc/dsc//did/unitdate[not(normalize-space(.))]
return
<record>
<id>{$id}</id>
<repo>{data($repo)}</repo>
<u>{$didEmptyTitle}</u>
</record>
}
</data>
<data>
{
for $Record in /ead
where $Record/archdesc/dsc//did/unittitle[not(normalize-space(.))]
let $id := $Record/archdesc/did/unitid[@type='clio']/text()
let $repo := $Record/archdesc/did/unitid[1]/@repositorycode
let $didEmptyTitle := $Record/archdesc/dsc//did/unittitle[not(normalize-space(.))]
return
<record>
<id>{$id}</id>
<repo>{data($repo)}</repo>
<u>{$didEmptyTitle}</u>
</record>
}
</data>
<data>
{
for $Record in /ead
where $Record//dsc//did[(not(unittitle) and not(unitdate))]
let $id := $Record/archdesc/did/unitid[@type='clio']/text()
let $repo := $Record/archdesc/did/unitid[1]/@repositorycode
let $didNoTitleDate := $Record/archdesc/dsc//did[(not(unittitle) and not(unitdate))]
return
<record>
<id>{$id}</id>
<repo>{data($repo)}</repo>
<u>{$didNoTitleDate}</u>
</record>
}
</data>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment