Project

General

Profile

metacat / lib / style / skins / metacatui / eml-2 / eml-identifier.xsl @ 8083

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: leinfelder $'
10
  *     '$Date: 2013-07-26 12:07:45 -0700 (Fri, 26 Jul 2013) $'
11
  * '$Revision: 8083 $'
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="UTF-8"
35
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
36
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
37
    indent="yes" />  
38
    
39
    <!-- style the identifier and system -->
40
    <xsl:template name="identifier">
41
      <xsl:param name="IDfirstColStyle"/>
42
      <xsl:param name="IDsecondColStyle"/>
43
      <xsl:param name="packageID"/>
44
      <xsl:param name="system"/>
45
      <xsl:if test="normalize-space(.)">
46
        <div class="control-group">
47
          <label class="control-label">Identifier</label>
48
          <div class="controls">
49
          	<div class="controls-well">
50
          		<xsl:value-of select="$packageID"/>
51
          	</div>
52
			<xsl:if test="$withHTMLLinks = '1'">
53
	          	<!-- stats loaded with ajax call -->
54
				<span id="stats"></span>
55
				<script language="JavaScript">
56
					if (window.loadStats) {
57
						loadStats(
58
							'stats', 
59
							'<xsl:value-of select="$packageID" />', 
60
							'<xsl:value-of select="$contextURL" />/metacat',
61
							'<xsl:value-of select="$qformat" />');
62
					}
63
				</script>
64
			</xsl:if>
65
			
66
          </div>
67
        </div>
68
      </xsl:if>
69
    </xsl:template>
70
    
71
    <!-- for citation information -->
72
    <xsl:template name="datasetcitation">
73
    
74
    	<div class="well">
75
    		<div class="row-fluid">
76
    			<div class="span10">
77
    				<xsl:for-each select="creator">
78
    				
79
    					<xsl:choose>
80
							<xsl:when test="references!=''">
81
							 <xsl:variable name="ref_id" select="references"/>
82
							 <xsl:variable name="references" select="$ids[@id=$ref_id]" />
83
							 <xsl:for-each select="$references">
84
							 
85
							 	<!-- process the reference -->
86
							 	<xsl:if test="position() &gt; 1">
87
				        			<xsl:if test="last() &gt; 2">, </xsl:if>
88
				        			<xsl:if test="position() = last()"> and</xsl:if>
89
				        			<xsl:text> </xsl:text>
90
				        		</xsl:if>
91
				        		<xsl:call-template name="creatorCitation" />
92
				        		<xsl:if test="position() = last()">.</xsl:if>
93
				        		<xsl:text> </xsl:text>
94
				        		
95
							 </xsl:for-each>
96
							</xsl:when>
97
							<xsl:otherwise>
98
							
99
								<!-- just the creator element -->
100
								<xsl:if test="position() &gt; 1">
101
				        			<xsl:if test="last() &gt; 2">, </xsl:if>
102
				        			<xsl:if test="position() = last()"> and</xsl:if>
103
				        			<xsl:text> </xsl:text>
104
				        		</xsl:if>
105
				        		<xsl:call-template name="creatorCitation" />
106
				        		<xsl:if test="position() = last()">.</xsl:if>
107
				        		<xsl:text> </xsl:text>
108
				        		
109
							</xsl:otherwise>
110
						</xsl:choose>
111
		        		 		
112
		        	</xsl:for-each>
113
		        	
114
		        	<xsl:value-of select="substring(string(pubDate),1,4)"/>
115
		        	<xsl:if test="substring(string(pubDate),1,4) != ''">
116
		        		<xsl:text>. </xsl:text>    				     		
117
		        	</xsl:if>
118
		        	
119
		        	<!-- title -->
120
					<strong>
121
					<xsl:for-each select="./title">
122
			     		<xsl:call-template name="i18n">
123
			     			<xsl:with-param name="i18nElement" select="."/>
124
			     		</xsl:call-template>
125
		        		<xsl:text> </xsl:text>    				     		
126
			     	</xsl:for-each>				
127
					</strong>
128
					
129
					<!-- show link? -->
130
					<xsl:if test="$withHTMLLinks = '1'">
131
						<a id="viewMetadataCitationLink"> 
132
							<xsl:attribute name="href">
133
								<!--<xsl:value-of select="$viewURI"/><xsl:value-of select="$pid"/>-->
134
								<xsl:text>#view/</xsl:text><xsl:value-of select="$pid"/>
135
							</xsl:attribute>
136
							(<xsl:value-of select="$pid"/>)
137
						</a>				        		
138
					</xsl:if>
139
    			</div>
140
    			<div id="downloadPackage" class="span2">
141
   					<a class="btn">
142
   						<xsl:attribute name="href">
143
							<xsl:value-of select="$packageURI"/><xsl:value-of select="$pid"/>
144
						</xsl:attribute>
145
   						Download <i class="icon-arrow-down"></i>
146
   					</a>
147
    			</div>	
148
  
149
    		</div>
150
				
151
		</div>
152

    
153
   </xsl:template>
154
   
155
   <!--************** creates lsid dataset id **************-->
156
   <xsl:template name="lsid">
157
		<xsl:variable name="lsidString1" select="concat('urn:lsid:',string($lsidauthority),':')"/>
158
		<xsl:variable name="lsidString2" select="concat($lsidString1, substring-before(string(../@packageId),'.'), ':')"/>
159
		<xsl:variable name="lsidString3" select="concat($lsidString2, substring-before(substring-after(string(../@packageId),'.'),'.'), ':')"/>
160
		<xsl:variable name="lsidString4" select="concat($lsidString3, substring-after(substring-after(string(../@packageId),'.'),'.'))"/>
161
		<xsl:value-of select="$lsidString4"/>
162
   </xsl:template>
163
   
164
   <!--************** creates citation for a creator in "Last FM" format **************-->
165
   <xsl:template name="creatorCitation">
166
	   	<xsl:for-each select="individualName">	
167
	   		
168
	   		<xsl:value-of select="surName/text()"/>
169
	   		<xsl:text> </xsl:text>
170
	   		
171
	   		<xsl:for-each select="givenName">
172
	   			<xsl:value-of select="substring(string(.),1,1)"/>
173
	   		</xsl:for-each>
174
	   	</xsl:for-each>
175
	   	
176
	   	<!-- only show organization if the person is omitted  -->
177
	   	<xsl:if test="string(individualName/surName) = ''"> 
178
		   	<xsl:for-each select="organizationName">
179
		   		<xsl:value-of select="."/>
180
		   	</xsl:for-each>
181
	   	</xsl:if>
182
	   	
183
   </xsl:template>
184
    
185
 </xsl:stylesheet>