Last active
September 16, 2024 08:06
-
-
Save zuphilip/616c62f62b44c0d49c04c5a2d4ce7951 to your computer and use it in GitHub Desktop.
CSV to ead.XML with XQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for $record in db:open("transform") | |
let $collection := $record//record[level="collection"] | |
for $child in $record//record[parent=$collection/id] | |
for $gchild in $record//record[parent=$child/id] | |
return | |
<ead> | |
<eadheader >...</eadheader> | |
<archdesc level="collection" id="{ $collection/id }"> | |
<did>...</did> | |
<dsc> | |
<c level="{ $child/level }" id="{ $child/id }"> | |
<c level="{ $gchild/level }" id="{ $gchild/id }"> | |
<did>...</did> | |
{ for $ggchild allowing empty in $record//record[parent=$gchild/id] | |
return | |
if ($ggchild/id != '') then | |
<c level="{ $ggchild/level }" id="{ $ggchild/id }"> | |
<did>...</did> | |
{ for $gggchild allowing empty in $record//record[parent=$ggchild/id] | |
return | |
if ($gggchild/id != '') then | |
<c level="{ $gggchild/level }" id="{ $gggchild/id }">...</c> | |
else () | |
} | |
</c> | |
else () | |
} | |
</c> | |
</c> | |
</dsc> | |
</archdesc> | |
</ead> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id | level | title | parent | |
---|---|---|---|---|
4901 | collection | Titel des Nachlasses | ||
4901-1 | fonds | Titel des Teilnachlasses | 4901 | |
4901-2 | class | Titel des Systematikpunktes | 4901-1 | |
4901-3 | file | Titel einer Verzeichniseinheit (Konvolut) | 4901-2 | |
4901-4 | file | Titel einer Verzeichniseinheit (Konvolut) | 4901-2 | |
4901-5 | item | Titel eines Einzeldokuments | 4901-4 | |
4901-6 | item | Titel eines Einzeldokuments | 4901-4 | |
4901-7 | item | Titel eines Einzeldokuments | 4901-4 | |
4901-8 | item | Titel eines Einzeldokuments | 4901-2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ead> | |
<eadheader>...</eadheader> | |
<archdesc level="collection" id="4901"> | |
<did>...</did> | |
<dsc> | |
<c level="fonds" id="4901-1"> | |
<c level="class" id="4901-2"> | |
<did>...</did> | |
<c level="file" id="4901-3"> | |
<did>...</did> | |
</c> | |
<c level="file" id="4901-4"> | |
<did>...</did> | |
<c level="item" id="4901-5">...</c> | |
<c level="item" id="4901-6">...</c> | |
<c level="item" id="4901-7">...</c> | |
</c> | |
<c level="item" id="4901-8"> | |
<did>...</did> | |
</c> | |
</c> | |
</c> | |
</dsc> | |
</archdesc> | |
</ead> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment