Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile$'
4
  *      Authors: Matthew Brooke
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-30 13:23:17 -0700 (Mon, 30 Jun 2003) $'
11
  * '$Revision: 1702 $'
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-variable.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
  <xsl:output method="html" encoding="iso-8859-1"/>
35
  
36
  <!-- This module is for party member and it is self contained-->
37

    
38
  <xsl:template name="party">
39
      <xsl:param name="partyfirstColStyle"/>
40
      <table xsl:use-attribute-sets="cellspacing" class="tabledefault" width="100%">
41
        <xsl:choose>
42
         <xsl:when test="references!=''">
43
          <xsl:variable name="ref_id" select="references"/>
44
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
45
          <xsl:for-each select="$references">
46
            <xsl:apply-templates mode="party">
47
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
48
            </xsl:apply-templates>
49
          </xsl:for-each>
50
        </xsl:when>
51
        <xsl:otherwise>
52
          <xsl:apply-templates mode="party">
53
            <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
54
          </xsl:apply-templates>
55
        </xsl:otherwise>
56
      </xsl:choose>
57
      </table>
58
  </xsl:template>
59

    
60
  <!-- *********************************************************************** -->
61

    
62
 
63
  <xsl:template match="individualName" mode="party">
64
      <xsl:param name="partyfirstColStyle"/>
65
      <xsl:if test="normalize-space(.)!=''">
66
        <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
67
            Individual:</td><td width="{$secondColWidth}" class="{$secondColStyle}" >
68
           <b><xsl:value-of select="./salutation"/><xsl:text> </xsl:text>
69
           <xsl:value-of select="./givenName"/><xsl:text> </xsl:text>
70
           <xsl:value-of select="./surName"/></b>
71
        </td></tr>
72
      </xsl:if>
73
  </xsl:template>
74

    
75
 
76
  <xsl:template match="organizationName" mode="party">
77
      <xsl:param name="partyfirstColStyle"/>
78
      <xsl:if test="normalize-space(.)!=''">
79
        <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
80
        Organization:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
81
        <b><xsl:value-of select="."/></b>
82
        </td></tr>
83
      </xsl:if>
84
  </xsl:template>
85

    
86
  
87
  <xsl:template match="positionName" mode="party">
88
      <xsl:param name="partyfirstColStyle"/>
89
      <xsl:if test="normalize-space(.)!=''">
90
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}">
91
        Position:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
92
        <xsl:value-of select="."/></td></tr>
93
      </xsl:if>
94
  </xsl:template>
95

    
96
  
97
  <xsl:template match="address" mode="party">
98
    <xsl:param name="partyfirstColStyle"/>
99
    <xsl:if test="normalize-space(.)!=''">
100
      <xsl:call-template name="addressCommon">
101
         <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
102
      </xsl:call-template>
103
    </xsl:if>
104
    </xsl:template>
105
    
106
   <!-- This template will be call by other place-->
107
   <xsl:template name="address">
108
      <xsl:param name="partyfirstColStyle"/>
109
      <table xsl:use-attribute-sets="cellspacing" class="tableparty" width="100%">
110
        <xsl:choose>
111
         <xsl:when test="references!=''">
112
          <xsl:variable name="ref_id" select="references"/>
113
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
114
          <xsl:for-each select="$references">
115
            <xsl:call-template name="addressCommon">
116
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
117
            </xsl:call-template>
118
          </xsl:for-each>
119
        </xsl:when>
120
        <xsl:otherwise>
121
          <xsl:call-template name="addressCommon">
122
             <xsl:with-param name="partyfirstColStyle" select="$partyfirstColStyle"/>
123
          </xsl:call-template>
124
        </xsl:otherwise>
125
      </xsl:choose>
126
      </table>
127
  </xsl:template>
128
   
129
   <xsl:template name="addressCommon">
130
    <xsl:param name="partyfirstColStyle"/>
131
    <xsl:if test="normalize-space(.)!=''">
132
    <tr><td width="{$firstColWidth}" valign="top" class="{$partyfirstColStyle}">
133
        Address:</td><td width="{$secondColWidth}" >
134
    <table xsl:use-attribute-sets="cellspacing" class="tableparty" width="100%">
135
    <xsl:for-each select="deliveryPoint">
136
    <tr><td class="{$secondColStyle}"><xsl:value-of select="."/><xsl:text>, </xsl:text></td></tr>
137
    </xsl:for-each>
138
    <!-- only include comma if city exists... -->
139
    <tr><td class="{$secondColStyle}" >
140
    <xsl:if test="normalize-space(city)!=''">
141
        <xsl:value-of select="city"/><xsl:text>, </xsl:text>
142
    </xsl:if>
143
    <xsl:if test="normalize-space(administrativeArea)!='' or normalize-space(postalCode)!=''">
144
        <xsl:value-of select="administrativeArea"/><xsl:text> </xsl:text><xsl:value-of select="postalCode"/><xsl:text> </xsl:text>
145
    </xsl:if>
146
    <xsl:if test="normalize-space(country)!=''">
147
      <xsl:value-of select="country"/>
148
    </xsl:if></td></tr>
149
    </table></td></tr>
150
    </xsl:if>
151
   </xsl:template>
152
 
153
  <xsl:template match="phone" mode="party">
154
      <xsl:param name="partyfirstColStyle"/>
155
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
156
        Phone:</td><td width="{$secondColWidth}"  class="{$secondColStyle}">
157
       <xsl:value-of select="."/>
158
       <xsl:if test="normalize-space(./@phonetype)!=''">
159
            <xsl:text> (</xsl:text><xsl:value-of select="./@phonetype"/><xsl:text>)</xsl:text>
160
       </xsl:if></td></tr>
161
  </xsl:template>
162

    
163
 
164
  <xsl:template match="electronicMailAddress" mode="party">
165
      <xsl:param name="partyfirstColStyle"/>
166
      <xsl:if test="normalize-space(.)!=''">
167
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
168
        Email Address:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
169
        <a><xsl:attribute name="href">mailto:<xsl:value-of select="."/></xsl:attribute><xsl:value-of select="./entityName"/>
170
        <xsl:value-of select="."/></a></td></tr>
171
      </xsl:if>
172
  </xsl:template>
173

    
174
  
175
  <xsl:template match="onlineUrl" mode="party">
176
      <xsl:param name="partyfirstColStyle"/> 
177
      <xsl:if test="normalize-space(.)!=''">
178
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
179
        Web Address:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
180
        <xsl:value-of select="."/></td></tr>
181
      </xsl:if>
182
  </xsl:template>
183

    
184

    
185
  <xsl:template match="userId" mode="party">
186
      <xsl:param name="partyfirstColStyle"/>
187
      <xsl:if test="normalize-space(.)!=''">
188
      <tr><td width="{$firstColWidth}" class="{$partyfirstColStyle}" >
189
        Id:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
190
        <xsl:value-of select="."/></td></tr>
191
      </xsl:if>
192
  </xsl:template>
193
  <xsl:template match="text()" mode="party" />
194
</xsl:stylesheet>
(18-18/30)