Last active
October 5, 2015 20:17
-
-
Save caschwartz/2869587 to your computer and use it in GitHub Desktop.
Query adds identifiers to local metadata schema <volumeInfo> elements
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
| xquery version "1.0-ml"; | |
| (: 5/31/12 This query adds identifiers to <volumeInfo> elements :) | |
| declare namespace ia = "http://my.server/my.directory"; | |
| declare namespace m = "http://www.loc.gov/MARC21/slim"; | |
| let $docs := xdmp:directory("/ia-xml/f/", "infinity") | |
| let $titles := $docs/ia:doc/ia:metadata/ia:title | |
| for $title in $titles | |
| let $id := $title/preceding-sibling::ia:id | |
| let $volumeInfo := $title/following-sibling::ia:volumeInfo | |
| where $volumeInfo | |
| order by $title ascending | |
| return xdmp:node-insert-child($volumeInfo, attribute id { fn:replace($id, "^(.*)(\d{2}.*)$", "$1") })) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I need to work on this query some more. I need to get the id value from volume one of each set and use that value for each volume in the set.