Project

General

Profile

metacat / lib / style / common / log.xsl @ 10195

1
<?xml version="1.0"?>
2
	<!--
3
		* '$RCSfile$' * Authors: Jivka Bojilova * Copyright: 2000 Regents of
4
		the University of California and the * National Center for Ecological
5
		Analysis and Synthesis * For Details: http://www.nceas.ucsb.edu/ * *
6
		'$Author: leinfelder $' * '$Date: 2008-06-17 13:29:31 -0700 (Tue, 17
7
		Jun 2008) $' * '$Revision: 7405 $' * * This program is free software;
8
		you can redistribute it and/or modify * it under the terms of the GNU
9
		General Public License as published by * the Free Software Foundation;
10
		either version 2 of the License, or * (at your option) any later
11
		version. * * This program is distributed in the hope that it will be
12
		useful, * but WITHOUT ANY WARRANTY; without even the implied warranty
13
		of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
		GNU General Public License for more details. * * You should have
15
		received a copy of the GNU General Public License * along with this
16
		program; if not, write to the Free Software * Foundation, Inc., 59
17
		Temple Place, Suite 330, Boston, MA 02111-1307 USA * * This is an XSLT
18
		(http://www.w3.org/TR/xslt) stylesheet designed to * convert an XML
19
		file with information about login action * into an HTML format
20
		suitable for rendering with modern web browsers.
21
	-->
22
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
23
	version="1.0">
24
	<xsl:output method="html" />
25
	<xsl:param name="qformat">default</xsl:param>
26
	<xsl:param name="contextURL" />
27
	<xsl:param name="cgi-prefix" />
28
	<xsl:param name="simple">true</xsl:param>
29
	
30
		
31
	<xsl:key name="docIds" match="/log/logEntry/docid/text()" use="." />
32
	
33
	<xsl:template match="/">
34
		<html>
35
			<head>
36
				<link rel="stylesheet" type="text/css"
37
					href="{$contextURL}/style/skins/{$qformat}/{$qformat}.css" />
38
				<script language="Javascript" type="text/JavaScript"
39
					src="{$contextURL}/style/skins/{$qformat}/{$qformat}.js" />
40
				<script language="Javascript" type="text/JavaScript"
41
					src="{$contextURL}/style/common/branding.js" />
42
			</head>
43

    
44
			<body>
45
			
46
				<xsl:choose>
47
					<xsl:when test="$simple='true'">
48
						<xsl:for-each select="./log/logEntry/docid/text()[generate-id(.)=generate-id(key('docIds',.)[1])]">
49
							<xsl:variable name="uniqueDocid" select="."/>
50
							Views: <xsl:value-of select="count(//log/logEntry[docid=$uniqueDocid and event='read'])" />														
51
						</xsl:for-each>						
52
					</xsl:when>
53
					<xsl:otherwise>
54
						<table class="subGroup subGroup_border">
55
							
56
							<xsl:for-each select="./log/logEntry/docid/text()[generate-id()=generate-id(key('docIds',.)[1])]">
57
								<xsl:variable name="uniqueDocid" select="string(.)"/>
58
								<tr>
59
									<th colspan="2">
60
										Usage Statistics
61
									</th>
62
								</tr>
63
								<tr>
64
									<td>
65
										Doc Id:
66
									</td>
67
									<td>	 
68
										<xsl:value-of select="$uniqueDocid" />										
69
									</td>
70
								</tr>
71
								<tr>
72
									<td>
73
										Read:
74
									</td>
75
									<td>	 
76
										<xsl:value-of select="count(//log/logEntry[docid=$uniqueDocid and string(event)='read'])" />
77
									</td>
78
								</tr>
79
								<tr>
80
									<td>									
81
										Insert: 
82
									</td>
83
									<td>	
84
										<xsl:value-of select="count(//log/logEntry[docid=$uniqueDocid and string(event)='insert'])" />
85
									</td>
86
								</tr>
87
								<tr>
88
									<td>
89
										Update: 
90
									</td>
91
									<td>	
92
										<xsl:value-of select="count(//log/logEntry[docid=$uniqueDocid and string(event)='update'])" />
93
									</td>
94
								</tr>
95
								<tr>
96
									<td>
97
										Delete: 
98
									</td>
99
									<td>	
100
										<xsl:value-of select="count(//log/logEntry[docid=$uniqueDocid and event/text() = 'delete'])" />
101
									</td>
102
								</tr>
103
								<tr>
104
									<td>
105
										Other: 
106
									</td>
107
									<td>	
108
										<xsl:value-of select="count(//log/logEntry[docid=$uniqueDocid and (event/text() != 'read' and event/text() != 'insert' and event/text() != 'update' and event/text() != 'delete')])" />
109
									</td>
110
								</tr>
111
								<tr>
112
									<td>
113
										Total: 
114
									</td>
115
									<td>	
116
										<xsl:value-of select="count(//log/logEntry[docid=$uniqueDocid])" />
117
									</td>
118
								</tr>
119
								
120
							</xsl:for-each>
121
						
122
						</table>
123
					</xsl:otherwise>
124
				</xsl:choose>	
125
			</body>
126
			
127
		</html>
128
	</xsl:template>
129
</xsl:stylesheet>