Project

General

Profile

1 4823 daigle
<?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: cjones $'
10
  *     '$Date: 2006-11-17 13:37:07 -0800 (Fri, 17 Nov 2006) $'
11
  * '$Revision: 3094 $'
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
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
37
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
38
    indent="yes" />
39
  <xsl:template name="access">
40
    <xsl:param name="accessfirstColStyle"/>
41
    <xsl:param name="accesssubHeaderStyle"/>
42
    <table class="{$tabledefaultStyle}">
43
        <xsl:choose>
44
         <xsl:when test="references!=''">
45
          <xsl:variable name="ref_id" select="references"/>
46
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
47
          <xsl:for-each select="$references">
48
            <xsl:call-template name="accessCommon">
49
             <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
50
             <xsl:with-param name="accesssubHeaderStyle" select="$accesssubHeaderStyle"/>
51
            </xsl:call-template>
52
          </xsl:for-each>
53
        </xsl:when>
54
        <xsl:otherwise>
55
          <xsl:call-template name="accessCommon">
56
             <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
57
             <xsl:with-param name="accesssubHeaderStyle" select="$accesssubHeaderStyle"/>
58
          </xsl:call-template>
59
        </xsl:otherwise>
60
      </xsl:choose>
61
    </table>
62
63
  </xsl:template>
64
  <xsl:template name="accessCommon">
65
     <xsl:param name="accessfirstColStyle" />
66
     <xsl:param name="accesssubHeaderStyle"/>
67
        <xsl:call-template name="accesssystem">
68
           <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
69
           <xsl:with-param name="accesssubHeaderStyle" select="$accesssubHeaderStyle"/>
70
        </xsl:call-template>
71
        <xsl:if test="normalize-space(./@order)='allowFirst' and (allow)">
72
            <xsl:call-template name="allow_deny">
73
                <xsl:with-param name="permission" select="'allow'"/>
74
                <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
75
             </xsl:call-template>
76
        </xsl:if>
77
        <xsl:if test="(deny)">
78
           <xsl:call-template name="allow_deny">
79
                <xsl:with-param name="permission" select="'deny'"/>
80
                <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
81
            </xsl:call-template>
82
        </xsl:if>
83
        <xsl:if test="normalize-space(acl/@order)='denyFirst' and (allow)">
84
            <xsl:call-template name="allow_deny">
85
                <xsl:with-param name="permission" select="'allow'"/>
86
                <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
87
            </xsl:call-template>
88
        </xsl:if>
89
90
91
  </xsl:template>
92
93
94
  <xsl:template name="allow_deny">
95
   <xsl:param name="permission"/>
96
   <xsl:param name="accessfirstColStyle" />
97
   <xsl:choose>
98
       <xsl:when test="$permission='allow'">
99
          <xsl:for-each select="allow">
100
            <tr>
101
              <td class="{$accessfirstColStyle}">
102
               Allow:
103
              </td>
104
              <td class="{$accessfirstColStyle}">
105
                <xsl:for-each select="./permission">
106
                  <xsl:text>[</xsl:text><xsl:value-of select="."/><xsl:text>] </xsl:text>
107
                </xsl:for-each>
108
              </td>
109
              <td class="{$accessfirstColStyle}" >
110
                <xsl:for-each select="principal">
111
                  <xsl:value-of select="."/><br/>
112
                </xsl:for-each>
113
              </td>
114
            </tr>
115
          </xsl:for-each>
116
       </xsl:when>
117
       <xsl:otherwise>
118
         <xsl:for-each select="deny">
119
            <tr>
120
              <td class="{$accessfirstColStyle}">
121
               Deny:
122
              </td>
123
              <td class="{$accessfirstColStyle}">
124
                <xsl:for-each select="./permission">
125
                  <xsl:text>[</xsl:text><xsl:value-of select="."/><xsl:text>] </xsl:text>
126
                </xsl:for-each>
127
              </td>
128
              <td class="{$accessfirstColStyle}" >
129
                <xsl:for-each select="principal">
130
                  <xsl:value-of select="."/><br/>
131
                </xsl:for-each>
132
              </td>
133
            </tr>
134
         </xsl:for-each>
135
       </xsl:otherwise>
136
   </xsl:choose>
137
138
   </xsl:template>
139
140
  <xsl:template name="accesssystem">
141
       <xsl:param name="accessfirstColStyle" />
142
        <tr>
143
          <th colspan="3">
144
            <xsl:text>Access Control:</xsl:text>
145
          </th>
146
        </tr>
147
        <tr>
148
          <td class="{$accessfirstColStyle}">Auth System:</td>
149
          <td class="{$secondColStyle}"><xsl:value-of select="./@authSystem"/></td>
150
        </tr>
151
        <tr>
152
          <td class="{$accessfirstColStyle}">Order:</td>
153
          <td class="{$secondColStyle}"><xsl:value-of select="./@order"/></td>
154
        </tr>
155
  </xsl:template>
156
157
</xsl:stylesheet>