1
|
<?xml version="1.0"?>
|
2
|
<!--
|
3
|
* '$RCSfile$'
|
4
|
* Authors: Matt Jones
|
5
|
* Copyright: 2000 Regents of the University of California and the
|
6
|
* National Center for Ecological Analysis and Synthesis
|
7
|
* For Details: http://www.nceas.ucsb.edu/
|
8
|
*
|
9
|
* '$Author: tao $'
|
10
|
* '$Date: 2003-07-03 17:17:46 -0700 (Thu, 03 Jul 2003) $'
|
11
|
* '$Revision: 1726 $'
|
12
|
*
|
13
|
* This program is free software; you can redistribute it and/or modify
|
14
|
* it under the terms of the GNU General Public License as published by
|
15
|
* the Free Software Foundation; either version 2 of the License, or
|
16
|
* (at your option) any later version.
|
17
|
*
|
18
|
* This program is distributed in the hope that it will be useful,
|
19
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21
|
* GNU General Public License for more details.
|
22
|
*
|
23
|
* You should have received a copy of the GNU General Public License
|
24
|
* along with this program; if not, write to the Free Software
|
25
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
26
|
*
|
27
|
* This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
|
28
|
* convert an XML file that is valid with respect to the eml-dataset.dtd
|
29
|
* module of the Ecological Metadata Language (EML) into an HTML format
|
30
|
* suitable for rendering with modern web browsers.
|
31
|
-->
|
32
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
33
|
|
34
|
|
35
|
<xsl:output method="html" encoding="iso-8859-1"/>
|
36
|
<xsl:template name="access">
|
37
|
<xsl:param name="accessfirstColStyle"/>
|
38
|
<xsl:param name="accesssubHeaderStyle"/>
|
39
|
<table xsl:use-attribute-sets="cellspacing" class="tabledefault" width="100%">
|
40
|
<xsl:choose>
|
41
|
<xsl:when test="references!=''">
|
42
|
<xsl:variable name="ref_id" select="references"/>
|
43
|
<xsl:variable name="references" select="$ids[@id=$ref_id]" />
|
44
|
<xsl:for-each select="$references">
|
45
|
<xsl:call-template name="accessCommon">
|
46
|
<xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
|
47
|
<xsl:with-param name="accesssubHeaderStyle" select="$accesssubHeaderStyle"/>
|
48
|
</xsl:call-template>
|
49
|
</xsl:for-each>
|
50
|
</xsl:when>
|
51
|
<xsl:otherwise>
|
52
|
<xsl:call-template name="accessCommon">
|
53
|
<xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
|
54
|
<xsl:with-param name="accesssubHeaderStyle" select="$accesssubHeaderStyle"/>
|
55
|
</xsl:call-template>
|
56
|
</xsl:otherwise>
|
57
|
</xsl:choose>
|
58
|
</table>
|
59
|
|
60
|
</xsl:template>
|
61
|
<xsl:template name="accessCommon">
|
62
|
<xsl:param name="accessfirstColStyle" />
|
63
|
<xsl:param name="accesssubHeaderStyle"/>
|
64
|
<xsl:call-template name="accesssystem">
|
65
|
<xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
|
66
|
<xsl:with-param name="accesssubHeaderStyle" select="$accesssubHeaderStyle"/>
|
67
|
</xsl:call-template>
|
68
|
<tr><td class="{$accesssubHeaderStyle}" colspan="2">
|
69
|
<xsl:text>Access Rules:</xsl:text></td></tr>
|
70
|
<xsl:if test="normalize-space(./@order)='allowFirst' and (allow)">
|
71
|
<xsl:call-template name="allow_deny">
|
72
|
<xsl:with-param name="permission" select="'allow'"/>
|
73
|
<xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
|
74
|
</xsl:call-template>
|
75
|
</xsl:if>
|
76
|
<xsl:if test="(deny)">
|
77
|
<xsl:call-template name="allow_deny">
|
78
|
<xsl:with-param name="permission" select="'deny'"/>
|
79
|
<xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
|
80
|
</xsl:call-template>
|
81
|
</xsl:if>
|
82
|
<xsl:if test="normalize-space(acl/@order)='denyFirst' and (allow)">
|
83
|
<xsl:call-template name="allow_deny">
|
84
|
<xsl:with-param name="permission" select="'allow'"/>
|
85
|
<xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
|
86
|
</xsl:call-template>
|
87
|
</xsl:if>
|
88
|
|
89
|
|
90
|
</xsl:template>
|
91
|
|
92
|
|
93
|
<xsl:template name="allow_deny">
|
94
|
<xsl:param name="permission"/>
|
95
|
<xsl:param name="accessfirstColStyle" />
|
96
|
<xsl:param name="accesssubHeaderSytle"/>
|
97
|
<xsl:choose>
|
98
|
<xsl:when test="$permission='allow'">
|
99
|
<xsl:for-each select="allow">
|
100
|
<tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}" valign="top">
|
101
|
ALLOW:</td><td width="{$secondColWidth}">
|
102
|
<table xsl:use-attribute-sets="cellspacing" class="tabledefault" width="100%">
|
103
|
<tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">
|
104
|
<xsl:for-each select="./permission">
|
105
|
<xsl:text>[</xsl:text><xsl:value-of select="."/><xsl:text>] </xsl:text>
|
106
|
</xsl:for-each></td>
|
107
|
<td class="{$accessfirstColStyle}" width="{$secondColWidth}">
|
108
|
<xsl:for-each select="principal">
|
109
|
<xsl:value-of select="."/><br/>
|
110
|
</xsl:for-each>
|
111
|
</td></tr>
|
112
|
</table></td></tr>
|
113
|
</xsl:for-each>
|
114
|
</xsl:when>
|
115
|
<xsl:otherwise>
|
116
|
<xsl:for-each select="deny">
|
117
|
<tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}" valign="top">
|
118
|
DENY:</td><td width="{$secondColWidth}">
|
119
|
<table xsl:use-attribute-sets="cellspacing" class="tabledefault" width="100%">
|
120
|
<tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">
|
121
|
<xsl:for-each select="permission">
|
122
|
<xsl:text>[</xsl:text><xsl:value-of select="."/><xsl:text>] </xsl:text>
|
123
|
</xsl:for-each></td>
|
124
|
<td class="{$accessfirstColStyle}" width="{$secondColWidth}">
|
125
|
<xsl:for-each select="principal">
|
126
|
<xsl:value-of select="."/><br/>
|
127
|
</xsl:for-each>
|
128
|
</td></tr>
|
129
|
</table></td></tr>
|
130
|
</xsl:for-each>
|
131
|
</xsl:otherwise>
|
132
|
</xsl:choose>
|
133
|
|
134
|
</xsl:template>
|
135
|
|
136
|
<xsl:template name="accesssystem">
|
137
|
<xsl:param name="accessfirstColStyle" />
|
138
|
<xsl:param name="accesssubHeaderStyle"/>
|
139
|
<tr><td class="{$accesssubHeaderStyle}" colspan="2">
|
140
|
<xsl:text>Access Control:</xsl:text></td></tr>
|
141
|
<tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">Auth System:</td>
|
142
|
<td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="./@authSystem"/></td>
|
143
|
</tr>
|
144
|
<tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">Order:</td>
|
145
|
<td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="./@order"/></td>
|
146
|
</tr>
|
147
|
</xsl:template>
|
148
|
|
149
|
</xsl:stylesheet>
|