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: 2000-11-20 05:14:04 -0800 (Mon, 20 Nov 2000) $'
11
  * '$Revision: 553 $'
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 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>Rules:</xsl:text></td></tr>
70
        <xsl:if test="normalize-space(./@order)='allowFirst' and (allow)">
71
        <tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">&#160;</td>
72
            <td width="{$secondColWidth}" class="{$secondColStyle}">&#160;</td>
73
        </tr>
74
            <xsl:call-template name="allow_deny">
75
                <xsl:with-param name="permission" select="'allow'"/>
76
                <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
77
             </xsl:call-template>
78
        </xsl:if>
79
        <xsl:if test="(deny)">
80
        <tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">&#160;</td>
81
            <td width="{$secondColWidth}" class="{$secondColStyle}">&#160;</td>
82
        </tr>
83
            <xsl:call-template name="allow_deny">
84
                <xsl:with-param name="permission" select="'deny'"/>
85
                <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
86
            </xsl:call-template>
87
        </xsl:if>
88
        <tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">&#160;</td>
89
            <td width="{$secondColWidth}" class="{$secondColStyle}">&#160;</td>
90
        </tr>
91
        <xsl:if test="normalize-space(acl/@order)='denyFirst' and (allow)">
92
            <xsl:call-template name="allow_deny">
93
                <xsl:with-param name="permission" select="'allow'"/>
94
                <xsl:with-param name="accessfirstColStyle" select="$accessfirstColStyle"/>
95
            </xsl:call-template>
96
        </xsl:if>
97
     
98
   
99
  </xsl:template>
100

    
101

    
102
  <xsl:template name="allow_deny">
103
   <xsl:param name="permission"/>
104
   <xsl:param name="accessfirstColStyle" />
105
   <xsl:param name="accesssubHeaderSytle"/>
106
   <xsl:choose>
107
       <xsl:when test="$permission='allow'">
108
           <xsl:for-each select="allow">
109
           <tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}" valign="top">
110
            ALLOW:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
111
                    <table width="100%">
112
                        <tr><td width="{$secondColIndent}" valign="top" class="{$accessfirstColStyle}">
113
                        <xsl:for-each select="./permission">
114
                            <xsl:text>[</xsl:text><xsl:value-of select="."/><xsl:text>] </xsl:text>
115
                        </xsl:for-each></td>
116
                        <td class="{$accessfirstColStyle}">
117
                        <xsl:for-each select="principal">
118
                            <xsl:value-of select="."/><br/>
119
                        </xsl:for-each>
120
                        </td></tr>
121
                        <tr><td width="{$secondColIndent}">&#160;</td><td>&#160;</td></tr>
122
                    </table></td></tr>
123
          </xsl:for-each>
124
       </xsl:when>
125
       <xsl:otherwise>
126
           <xsl:for-each select="deny">
127
        <tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}" valign="top">
128
            DENY:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
129
           <table width="100%">
130
              <tr><td width="{$secondColIndent}" valign="top" class="{$accessfirstColStyle}">
131
                <xsl:for-each select="permission">
132
                    <xsl:text>[</xsl:text><xsl:value-of select="."/><xsl:text>] </xsl:text>
133
                </xsl:for-each></td>
134
                <td class="{$accessfirstColStyle}">
135
                <xsl:for-each select="principal">
136
                    <xsl:value-of select="."/><br/>
137
                </xsl:for-each>
138
                </td></tr>
139
                <tr><td width="{$secondColIndent}">&#160;</td><td>&#160;</td></tr>
140
            </table></td></tr>
141
        </xsl:for-each>
142
       </xsl:otherwise>
143
   </xsl:choose>
144

    
145
   </xsl:template>
146
    
147
  <xsl:template name="accesssystem">
148
       <xsl:param name="accessfirstColStyle" />
149
       <xsl:param name="accesssubHeaderStyle"/>
150
        <tr><td class="{$accesssubHeaderStyle}" colspan="2">
151
        <xsl:text>Access Control:</xsl:text></td></tr>
152
        <tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">Auth System:</td>
153
            <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="./@authSystem"/></td>
154
        </tr>
155
        <tr><td width="{$firstColWidth}" class="{$accessfirstColStyle}">Order:</td>
156
            <td width="{$secondColWidth}" class="{$secondColStyle}"><xsl:value-of select="./@order"/></td>
157
        </tr>
158
  </xsl:template>
159
 
160
</xsl:stylesheet>
(3-3/27)