-
Notifications
You must be signed in to change notification settings - Fork 0
/
contents-editing.xsl
172 lines (161 loc) · 6.98 KB
/
contents-editing.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet []>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="#all #default xhtml c3"
version="1.0">
<!--
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:preserve-space elements="*" />
<xsl:template match="/">
<xsl:call-template name="toc" />
</xsl:template>
<!-- templates for Table of Contents (toc) -->
<xsl:template name="toc">
<b>
<xsl:call-template name="toc-link">
<xsl:with-param name="node" select="/ead/archdesc" />
<xsl:with-param name="level" select="'collectionLevel'" />
</xsl:call-template>
</b>
<xsl:apply-templates select="/ead/archdesc/dsc"
mode="toc" />
</xsl:template>
<xsl:template match="dsc" mode="toc">
<ul id="someId" class="hierarchy" name="1">
<xsl:for-each
select="c|c01|c02|c03|c04|c05|c06|c07|c08|c09|c10|c11|c12">
<xsl:if test="not(./@audience and ./@audience = 'internal')">
<li>
<xsl:call-template name="toc-c" />
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="toc-c"
match="c|c01|c02|c03|c04|c05|c06|c07|c08|c09|c10|c11|c12">
<xsl:call-template name="toc-link">
<xsl:with-param name="node" select="." />
</xsl:call-template>
<xsl:choose>
<xsl:when
test="c|c01|c02|c03|c04|c05|c06|c07|c08|c09|c10|c11|c12">
<ul class="hierarchy">
<xsl:attribute name="name">
<xsl:value-of select="count(ancestor::*)-1" />
</xsl:attribute>
<xsl:for-each
select="c|c01|c02|c03|c04|c05|c06|c07|c08|c09|c10|c11|c12">
<xsl:if
test="not(./@audience and ./@audience = 'internal')">
<li>
<xsl:call-template
name="toc-c" />
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:otherwise>
<a>
<xsl:attribute name="id">
<xsl:text>delete_</xsl:text><xsl:value-of select="./@c3id" />
</xsl:attribute>
<xsl:attribute name="onclick">
<xsl:text>javascript: deleteComponent('</xsl:text>
<xsl:value-of select="./@c3id" />
<xsl:text>')</xsl:text>
</xsl:attribute>
<img src="/ead/img/delete.png" class="deletelogo">
<xsl:attribute name="onmouseover">
<xsl:text>this.src='/ead/img/delete-hover.png';</xsl:text>
</xsl:attribute>
<xsl:attribute name="onmouseout">
<xsl:text>this.src='/ead/img/delete.png';</xsl:text>
</xsl:attribute>
</img>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="toc-link">
<xsl:param name="node" />
<xsl:param name="level" />
<a>
<xsl:attribute name="name">
<xsl:text>link</xsl:text>
</xsl:attribute>
<!-- check if all required xpaths are present or not -->
<xsl:choose>
<xsl:when test="$level = 'collectionLevel'">
<xsl:choose>
<xsl:when
test="$node/did/unitid and $node/did/unittitle and $node/did/unitdate and $node/did/unitdate/@normal and $node/did/repository and $node/did/origination and $node/did/physdesc/extent and $node/did/langmaterial/language and $node/scopecontent and $node/accessrestrict">
<xsl:attribute name="class"><xsl:text>valid</xsl:text></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class"><xsl:text>invalid</xsl:text></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when
test="$node/did/unitid and $node/did/unittitle and $node/did/unitdate">
<xsl:attribute name="class"><xsl:text>valid</xsl:text></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class"><xsl:text>invalid</xsl:text></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$level = 'collectionLevel'">
<xsl:attribute name="id">
<xsl:text>collectionLevel</xsl:text>
</xsl:attribute>
<xsl:attribute name="onclick">
<xsl:text>javascript: displayForm('collectionLevel')</xsl:text>
</xsl:attribute>
<xsl:attribute name="style"><xsl:text>background:yellow</xsl:text></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="id">
<xsl:value-of select="$node/@c3id" />
</xsl:attribute>
<xsl:attribute name="onclick">
<xsl:text>javascript: displayForm('</xsl:text>
<xsl:value-of select="$node/@c3id" />
<xsl:text>')</xsl:text>
</xsl:attribute>
<!-- <xsl:attribute name="onclick"> <xsl:text>setCookie('RECID-tocstate',
stateToString('someId'))</xsl:text> </xsl:attribute> -->
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$node/did/unitid">
<xsl:value-of select="$node/did/unitid" />
<xsl:text> - </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="$node/did/unittitle">
<xsl:value-of select="$node/did/unittitle" />
</xsl:when>
<xsl:when
test="$node/../eadheader/filedesc/titlestmt/titleproper">
<xsl:value-of
select="$node/../eadheader/filedesc/titlestmt/titleproper" />
</xsl:when>
<xsl:otherwise>
<xsl:text>(untitled)</xsl:text>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:template>
</xsl:stylesheet>