Skip to content

Instantly share code, notes, and snippets.

@CJHArch
Created October 8, 2015 14:36
Show Gist options
  • Save CJHArch/824b3bb99301c78e7834 to your computer and use it in GitHub Desktop.
Save CJHArch/824b3bb99301c78e7834 to your computer and use it in GitHub Desktop.
This XSLT adds a level attribute to the c03 components lacking one, in an EAD stylesheet
<?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">
<!-- IdentityTransform -->
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="c03[not(@level)]">
<c03 level="file">
<xsl:apply-templates select="@*|comment()"/>
</c03>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment