Last active
October 25, 2016 18:38
-
-
Save caschwartz/2845857 to your computer and use it in GitHub Desktop.
XQuery - Query METS documents to normalize book title list
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"; | |
| (: 7/13/11 Working on browse book title list for Digital Library of AK :) | |
| declare namespace METS = "http://www.loc.gov/METS/"; | |
| declare namespace dc = "http://purl.org/dc/elements/1.1/"; | |
| declare namespace html = "http://www.w3.org/1999/xhtml"; | |
| let $collection := fn:collection() | |
| let $first-section := $collection/METS:mets/METS:dmdSec[1] | |
| let $books := $first-section/METS:mdWrap/METS:xmlData[dc:type = "Book"] | |
| for $title in $books/dc:title | |
| (: order by fn:normalize-space(fn:replace($title,'(\(|\[|\"|The |An? |(\d. ?)|V?(I*)( |\.))*','')) :) | |
| order by $title ascending | |
| return fn:data($title) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment