Project

General

Profile

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-06-26 18:29:36 -0700 (Thu, 26 Jun 2003) $'
11
  * '$Revision: 1696 $'
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}" class="{$secondColStyle}">
102
                    <table xsl:use-attribute-sets="cellspacing" class="tabledefault" width="100%">
103
                        <tr><td width="{$secondColIndent}" valign="top" 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}">
108
                        <xsl:for-each select="principal">
109
                            <xsl:value-of select="."/><br/>
110
                        </xsl:for-each>
111
                        </td></tr>
112
                        <tr><td width="{$secondColIndent}">&#160;</td><td>&#160;</td></tr>
113
                    </table></td></tr>
114
          </xsl:for-each>
115
       </xsl:when>
116
       <xsl:otherwise>
117
           <xsl:for-each select="deny">
118
        <tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}" valign="top">
119
            DENY:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
120
           <table xsl:use-attribute-sets="cellspacing" class="tabledefault" width="100%">
121
              <tr><td width="{$secondColIndent}" valign="top" class="{$accessfirstColStyle}">
122
                <xsl:for-each select="permission">
123
                    <xsl:text>[</xsl:text><xsl:value-of select="."/><xsl:text>] </xsl:text>
124
                </xsl:for-each></td>
125
                <td class="{$accessfirstColStyle}">
126
                <xsl:for-each select="principal">
127
                    <xsl:value-of select="."/><br/>
128
                </xsl:for-each>
129
                </td></tr>
130
                <tr><td width="{$secondColIndent}">&#160;</td><td>&#160;</td></tr>
131
            </table></td></tr>
132
        </xsl:for-each>
133
       </xsl:otherwise>
134
   </xsl:choose>
135

    
136
   </xsl:template>
137
    
138
  <xsl:template name="accesssystem">
139
       <xsl:param name="accessfirstColStyle" />
140
       <xsl:param name="accesssubHeaderStyle"/>
141
        <tr><td class="{$accesssubHeaderStyle}" colspan="2">
142
        <xsl:text>Access Control:</xsl:text></td></tr>
143
        <tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">Auth System:</td>
144
            <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="./@authSystem"/></td>
145
        </tr>
146
        <tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">Order:</td>
147
            <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="./@order"/></td>
148
        </tr>
149
  </xsl:template>
150
 
151
</xsl:stylesheet>
(3-3/34)