-
Notifications
You must be signed in to change notification settings - Fork 0
/
contents.xsl
executable file
·171 lines (162 loc) · 6.85 KB
/
contents.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
<?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"
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:output method="html" indent="yes"/> -->
<!-- templates for Table of Contents (toc) -->
<xsl:template match="/ead" name="toc">
<!-- Search within description -->
<div class="withinCollection">
<xsl:call-template name="searchwithincollection"/>
</div>
<h2>
<xsl:text>Contents</xsl:text>
<!-- <xsl:text> </xsl:text> -->
<!-- <span class="printlink"> -->
<!-- <a href="SCRIPT/toc.html?recid=RECID"> -->
<!-- <xsl:text>[ printable ]</xsl:text> -->
<!-- </a> -->
<!-- </span> -->
</h2>
<div class="hierarchy">
<strong>
<xsl:call-template name="toc-link">
<xsl:with-param name="node"
select="/ead/archdesc/did" />
</xsl:call-template>
</strong>
<ul id="someId" class="hierarchy">
<xsl:apply-templates select="/ead/archdesc/dsc"
mode="toc" />
</ul>
</div>
</xsl:template>
<xsl:template match="dsc" mode="toc">
<xsl:for-each select="c|c01">
<xsl:if test="not(./@audience and ./@audience = 'internal')">
<li>
<xsl:call-template name="toc-c" />
</li>
</xsl:if>
</xsl:for-each>
</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="./did" />
</xsl:call-template>
<xsl:if test="c|c01|c02|c03|c04|c05|c06|c07|c08|c09|c10|c11|c12">
<ul class="hierarchy">
<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:if>
</xsl:template>
<xsl:template name="toc-link">
<xsl:param name="node" />
<a>
<xsl:attribute name="href">
<xsl:text>PAGE#</xsl:text>
<xsl:choose>
<xsl:when test="$node/../@id">
<xsl:value-of select="$node/../@id" />
</xsl:when>
<xsl:when test="$node/@id">
<xsl:value-of select="$node/@id" />
</xsl:when>
<xsl:when test="$node/unitid/@id">
<xsl:value-of select="$node/unitid/@id" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="generate-id($node)" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="onclick">
<xsl:text>setCookie('archiveshub_RECID_tocstate', stateToString('someId'), '/data/')</xsl:text>
</xsl:attribute>
<xsl:if test="$node/unitid">
<xsl:choose>
<xsl:when test="$node/unitid[@type='persistent']">
<xsl:value-of select="$node/unitid[@type='persistent']" />
</xsl:when>
<xsl:when test="$node/unitid[@label='Former Reference']">
<xsl:value-of
select="$node/unitid[@label != 'Former Reference']" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$node/unitid[1]" />
</xsl:otherwise>
</xsl:choose>
<xsl:text> - </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="$node/unittitle">
<xsl:value-of select="$node/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:template name="searchwithincollection">
<xsl:element name="form">
<xsl:attribute name="name">
<xsl:text>withinsearchform</xsl:text>
</xsl:attribute>
<xsl:attribute name="method">
<xsl:text>post</xsl:text>
</xsl:attribute>
<xsl:attribute name="class">
<xsl:text>panel-form</xsl:text>
</xsl:attribute>
<xsl:attribute name="action">
<xsl:value-of select="$script"/>
<xsl:text>/search.html</xsl:text>
</xsl:attribute>
<xsl:attribute name="onsubmit">
<xsl:text>setCookie('archiveshub_searchform', miniFormToString(this));</xsl:text>
</xsl:attribute>
<fieldset class="paleblue">
<span>Search within this description</span><br/>
<xsl:element name="input">
<xsl:attribute name="type"><xsl:text>hidden</xsl:text></xsl:attribute>
<xsl:attribute name="name"><xsl:text>withinCollection</xsl:text></xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="$recid" />
</xsl:attribute>
</xsl:element>
<input type="hidden" name="fieldidx1" value="cql.anywhere||dc.description||dc.title"/>
<input type="hidden" name="fieldrel1" value="all/relevant/proxinfo"/>
<input name="fieldcont1" type="text" size="18"/>
<input type="hidden" name="_charset_"/>
<input type="hidden" name="numreq" value="20"/>
<input type="hidden" name="firstrec" value="1"/>
<input type="submit" name="submit" value="Go" class="submit"/>
</fieldset>
</xsl:element>
</xsl:template>
</xsl:stylesheet>