Created
August 25, 2015 19:03
-
-
Save CJHArch/c20d57be953e78cadfc3 to your computer and use it in GitHub Desktop.
TSV out of EAD
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"?> | |
<!-- This stylesheet will generate a tsv file from an EAD container list. It will catch all c0X elements that have a did/container child --> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<!-- We don't want an xml declaration in the output, since this will just be a tab-separated text file--> | |
<xsl:output omit-xml-declaration="yes"/> | |
<!-- We don't want extra space floating around --> | |
<xsl:strip-space elements="*"/> | |
<!-- This will grab each did that has a container child (the for-each statement), and then output the value of the children. The normalize-space command is needed to remove extra odd space that sometimes happens within elements --> | |
<xsl:template match="/"> | |
<xsl:for-each select="ead/archdesc/dsc//did[container]"> | |
<xsl:value-of select="normalize-space(container[1])"/> | |
<xsl:text>	</xsl:text> | |
<xsl:value-of select="normalize-space(container[2])"/> | |
<xsl:text>	</xsl:text> | |
<xsl:value-of select="normalize-space(unittitle)"/> | |
<xsl:text>	</xsl:text> | |
<xsl:value-of select="normalize-space(unitdate)"/> | |
<xsl:text>	</xsl:text> | |
<xsl:value-of select="normalize-space(../scopecontent/p)"/> | |
<xsl:text> </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