-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathEAD_add_level_if_missing.xsl
34 lines (30 loc) · 1.24 KB
/
EAD_add_level_if_missing.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:ead="urn:isbn:1-931666-22-9"
version="1.0">
<!--standard identity template, which does all of the copying-->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!--add a @level='file' attribute if no level is expressed, prior to importing into ASpace -->
<xsl:template match="ead:dsc//ead:*[ead:did][not(@level)]">
<xsl:copy>
<xsl:attribute name="level">
<xsl:value-of select="'file'"/>
</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!--add a @level='collection' attribute if no level is expressed within archdesc, prior to importing into ASpace -->
<xsl:template match="ead:archdesc[not(@level)]">
<xsl:copy>
<xsl:attribute name="level">
<xsl:value-of select="'collection'"/>
</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>