Created
February 9, 2015 22:00
-
-
Save CJHArch/3b21aa3c826ef8e4e305 to your computer and use it in GitHub Desktop.
XSLT templates to grab various specific records from the OAI feed
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" version="1.0"> | |
<!--List of PIDS --> | |
<xsl:template match="/"> | |
<xsl:for-each select="results/record/header/identifier"> | |
<xsl:copy-of select="./text()"/>, | |
</xsl:for-each> | |
</xsl:template> | |
<!-- AHC records --> | |
<xsl:template match="/"> | |
<xsl:for-each select="results/record/metadata/record[datafield[@tag='094']/subfield[contains(., 'AHC')]]"> | |
<xsl:copy-of select="datafield[@tag='655']/subfield[not (contains (., 'Oral Histories'))]"/>, | |
</xsl:for-each> | |
</xsl:template> | |
<!-- UJA records --> | |
<xsl:template match="/"> | |
<xsl:for-each select="results/record/metadata/record[datafield[@tag='610']/subfield[contains(., 'United Jewish')]]"> | |
<xsl:copy-of select="datafield[@tag='655']/subfield[not (contains (., 'Oral Histories'))]"/>, | |
</xsl:for-each> | |
</xsl:template> | |
<!-- 25385 recordrecords --> | |
<xsl:template match="/"> | |
<xsl:for-each select="results/record/metadata/record[datafield[@tag='773']/subfield[contains(., '25385')]]"> | |
<xsl:copy-of select="datafield[@tag='655']/subfield[not (contains (., 'Oral Histories'))]"/>, | |
</xsl:for-each> | |
</xsl:template> | |
<!-- Grabs only those records with more than one 655 --> | |
<xsl:template match="/"> | |
<xsl:for-each select="results/record[metadata/record[datafield[@tag='655'][2]]]"> | |
<xsl:copy-of select="."/> | |
</xsl:for-each> | |
</xsl:template> | |
<!-- Identity to grab all records that aren't the above three --> | |
<xsl:template match="/ | @* | node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@* | node()"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="record[metadata/record/datafield[@tag='773']/subfield[contains(., '25385')]]"> </xsl:template> | |
<xsl:template match="record[metadata/record/datafield[@tag='094']/subfield[contains(., 'AHC')]]"/> | |
<xsl:template match="record[metadata/record/datafield[@tag='610']/subfield[contains(., 'United Jewish')]]"/> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment