Created
September 2, 2015 14:02
-
-
Save CJHArch/9378aef7244cdd0301b6 to your computer and use it in GitHub Desktop.
XSL to insert blank <container> into EAD (to address the c03 c04 repitition issue)
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"> | |
<!--copy everything--> | |
<xsl:output omit-xml-declaration="yes"/> | |
<xsl:template match="@* | node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@* | node()" mode="#current"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="did[../../c04[@level='file']]"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|comment()"/> | |
<xsl:apply-templates select="container"/> <!-- bring the containers to the top --> | |
<xsl:element name="container"></xsl:element> | |
<xsl:apply-templates select="* except container"/> <!-- process everything else --> | |
</xsl:copy> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment