Skip to content

Instantly share code, notes, and snippets.

@kschlottmann
Created June 9, 2020 15:11
Show Gist options
  • Save kschlottmann/e04d4a0848934359bda8a88776c32d83 to your computer and use it in GitHub Desktop.
Save kschlottmann/e04d4a0848934359bda8a88776c32d83 to your computer and use it in GitHub Desktop.
Get box/folder/title/date and publish status from an AS EAD (from a given series, only c-level data)
<?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" xmlns:ead="urn:isbn:1-931666-22-9"
exclude-result-prefixes="xs " version="2.0">
<xsl:template match="c">
<xsl:text>Title|Date|Box|Folder|Publish Status &#10;</xsl:text>
<xsl:apply-templates select="//c[@level = 'file']"/>
</xsl:template>
<xsl:template match="c[@level = 'file']">
<xsl:for-each select=".">
<xsl:value-of select="did/unittitle/normalize-space(.)"/>
<xsl:text>|</xsl:text>
<xsl:value-of select="did/unitdate/normalize-space(.)"/>
<xsl:text>|</xsl:text>
<xsl:value-of select="did/container[@type='box']/normalize-space(.)"/>
<xsl:text>|</xsl:text>
<xsl:value-of select="did/container[@type='folder']/normalize-space(.)"/>
<xsl:text>|</xsl:text>
<xsl:choose>
<xsl:when test=".[@audience]">
<xsl:text>FALSE</xsl:text>
<xsl:text>|</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>TRUE</xsl:text>
<xsl:text>|</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment