Last active
January 20, 2016 17:48
-
-
Save CJHArch/bce104c64ec87e4b7d64 to your computer and use it in GitHub Desktop.
This xquery pulls out 655s from the namespace-stripped Digitool OAI feed, as well as limiting by 852 and pulling out 852 information. Together with an XSLT that grouped the 665s into one tag, and an Excel text-to-columns conversion, we got the data.
This file contains 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 "3.0"; | |
<results> | |
{ | |
for $OAIMarcRecord in /repository/record[metadata/record/datafield[@tag="852"][contains(., "Baeck")]] | |
let $callno:= $OAIMarcRecord/metadata/record/datafield[@tag="094"] | |
let $title := $OAIMarcRecord/metadata/record/datafield[@tag="245"] | |
let $eighta := $OAIMarcRecord/metadata/record/datafield[@tag="852"]/subfield[@code='a'] | |
let $eightb := $OAIMarcRecord/metadata/record/datafield[@tag="852"]/subfield[@code='b'] | |
let $genre := $OAIMarcRecord/metadata/record/datafield[@tag="655"]/subfield[@code='a'] | |
let $PID := $OAIMarcRecord/header/identifier/substring-after(., "oai:digital.cjh.org:") | |
return | |
<r> | |
<c>{data($callno)}</c> | |
<t>{data($title)}</t> | |
<a>{data($PID)}</a> | |
<b>{data($eighta)}</b> | |
<p>{data($eightb)}</p> | |
{$genre} | |
</r> | |
} | |
</results> |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
exclude-result-prefixes="xs" | |
version="2.0"> | |
<xsl:template match="/"> | |
<results> | |
<xsl:for-each select="results/r"> | |
<r> | |
<xsl:copy-of select="c"/> | |
<xsl:copy-of select="t"/> | |
<xsl:copy-of select="a"/> | |
<xsl:copy-of select="b"/> | |
<xsl:copy-of select="p"/> | |
<g> | |
<xsl:for-each select="g"> | |
<xsl:value-of select="."/> | |
<xsl:text>;</xsl:text> | |
</xsl:for-each> | |
</g> | |
</r> | |
</xsl:for-each> | |
</results> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment