forked from NOAA-PMEL/LAS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
listing.xslt
107 lines (100 loc) · 3.28 KB
/
listing.xslt
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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
<xsl:output method="html" encoding="UTF-8" indent="no" doctype-system="about:legacy-compat" />
<xsl:template match="listing">
<html>
<head>
<title>Directory Listing For <xsl:value-of select="@directory" /></title>
<script language="JavaScript">
function setListingBackgrounds() {
var tblRows = document.getElementsByTagName("tr");
var numTblRows = tblRows.length;
var lastExpocode = "";
var expoNum = 0;
var filename;
var slashIdx;
var underscoreIdx;
var expocode;
for (var k = 0; k != numTblRows; k++) {
if ( (k % 2) == 0 ) {
tblRows[k].style.background = "white";
}
else {
tblRows[k].style.background = "#DDEEFF";
}
}
}
window.addEventListener("load", setListingBackgrounds, false);
</script>
<style>
body { margin: 0; font-family: sans-serif,Arial,Tahoma;
color: black; background-color: white; }
h1 { padding: 0.25em 0.75em; margin: 0; color: white; background-color: #0086b2; }
h3 { padding: 0.25em 0.75em; margin: 0; color: white; background-color : #0086b2; }
pre { margin: 0 }
a { color: black; }
table { border-spacing: 0; }
th.filename { padding: 0.5em 1.5em 0.25em; text-align: left; }
th.filesize { padding: 0.5em 1.5em 0.25em; text-align: right; }
th.filedate { padding: 0.5em 1.5em 0.25em; text-align: center; }
td.filename { padding: 0.0em 1.5em 0.25em; text-align: left; }
td.filesize { padding: 0.0em 1.5em 0.25em; text-align: right; }
td.filedate { padding: 0.0em 1.5em 0.25em; text-align: center; }
</style>
</head>
<body>
<xsl:choose>
<xsl:when test="contains(@directory,'MetadataDocs')">
<h1>Directory Listing For <xsl:value-of select="@directory" /></h1>
<table>
<tr>
<th class="filename">Filename</th>
<th class="filesize">Size</th>
<th class="filedate">Last Modified</th>
</tr>
<xsl:apply-templates select="entries" />
</table>
<xsl:apply-templates select="readme" />
<h3>SOCAT Data Management System</h3>
</xsl:when>
<xsl:otherwise>
<h2>Directory listing not allowed.</h2>
<h3>SOCAT Data Management System</h3>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
<xsl:template match="entries">
<xsl:apply-templates select="entry" />
</xsl:template>
<xsl:template match="readme">
<pre><xsl:apply-templates /></pre>
</xsl:template>
<xsl:template match="entry">
<xsl:choose>
<xsl:when test="contains(@urlPath,'OME.xml')">
</xsl:when>
<xsl:when test="contains(@urlPath,'.properties')">
</xsl:when>
<xsl:when test="contains(@urlPath,'.svn')">
</xsl:when>
<xsl:otherwise>
<xsl:variable name="urlPath" select="@urlPath" />
<tr id="{$urlPath}">
<td class="filename">
<a href="{$urlPath}">
<pre><xsl:apply-templates /></pre>
</a>
</td>
<td class="filesize">
<pre><xsl:value-of select="@size" /></pre>
</td>
<td class="filedate">
<pre><xsl:value-of select="@date" /></pre>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>