-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathead_order.xsl
73 lines (63 loc) · 2.18 KB
/
ead_order.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes" encoding="ascii"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="ead">
<xsl:element name="ead">
<xsl:copy-of select="@*" />
<xsl:copy-of select="/ead/eadheader" />
<xsl:apply-templates select="/ead/archdesc" />
</xsl:element>
</xsl:template>
<xsl:template match="/ead/archdesc|dsc|c|c01|c02|c03|c04|c05|c06|c07|c08|c09|c10|c11|c12">
<xsl:element name="{name()}">
<xsl:copy-of select="@*[not(name()='c3id')]"/>
<xsl:apply-templates select="did"/>
<xsl:copy-of select="dao"/>
<xsl:apply-templates select="daogrp"/>
<xsl:for-each select="node()">
<xsl:choose>
<xsl:when test="not(name() = 'did') and not(name() = 'dsc') and not(name() = 'controlaccess') and not(name() = 'c') and not(starts-with(name(), 'c0')) and not(starts-with(name(), 'c1')) and not(starts-with(name(), 'dao'))">
<xsl:copy-of select="." />
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:copy-of select="controlaccess" />
<xsl:if test="dsc|c|c01|c02|c03|c04|c05|c06|c07|c08|c09|c10|c11|c12">
<xsl:apply-templates select="dsc|c|c01|c02|c03|c04|c05|c06|c07|c08|c09|c10|c11|c12" />
</xsl:if>
</xsl:element>
</xsl:template>
<xsl:template match="did">
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:for-each select="node()">
<xsl:choose>
<xsl:when test="not(starts-with(name(), 'dao'))">
<xsl:copy-of select="."/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:copy-of select="dao"/>
<xsl:apply-templates select="daogrp"/>
</xsl:element>
</xsl:template>
<xsl:template match="daogrp">
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:copy-of select="daodesc"/>
<xsl:for-each select="node()">
<xsl:choose>
<xsl:when test="not(name() = 'daodesc')">
<xsl:copy-of select="."/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>