-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsruOutHub.xsl
executable file
·77 lines (66 loc) · 2.67 KB
/
sruOutHub.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
74
75
76
77
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet []>
<xsl:stylesheet
xmlns="http://www.loc.gov/ead"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c3="http://www.cheshire3.org"
xsi:schemaLocation="http://www.loc.gov/ead/ead.xsd"
version="1.0">
<!--
XSLT for sending Archives Hub flavoured EAD out via SRU
This file was produced for the Cheshire3 for Archives and the Archives Hub.
Copyright © 2005-2013 the University of Liverpool
-->
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:param name="script" select="'/services/ead'" />
<!-- Strip all audience=internal -->
<!-- this isn't reliable - it returns flat text
<xsl:template match='*[@audience="internal"]' priority="100" />
-->
<xsl:template match="*">
<xsl:variable name="tagname" select="local-name(.)" />
<xsl:choose>
<xsl:when
test="$tagname='ead' or $tagname='eadheader' or $tagname='eadid'">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:when>
<xsl:when test="./@audience='internal'" />
<!-- namespacify cheshire3 component wrapper -->
<xsl:when test="name(.)='c3:component' or $tagname='c3component'">
<c3:component>
<xsl:if test="./@parent">
<xsl:attribute name="c3:parent">
<xsl:value-of select="./@parent" />
</xsl:attribute>
</xsl:if>
<xsl:if test="./@xpath">
<xsl:attribute name="c3:xpath">
<xsl:value-of select="./@xpath" />
</xsl:attribute>
</xsl:if>
<xsl:if test="./@event">
<xsl:attribute name="c3:event">
<xsl:value-of select="./@event" />
</xsl:attribute>
</xsl:if>
<xsl:apply-templates />
</c3:component>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ARCHREF -->
<!-- do nothing - allow the Archives Hub to resolve as it likes -->
</xsl:stylesheet>