Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile$'
4
  *    Copyright: 2000 Regents of the University of California and the
5
  *               National Center for Ecological Analysis and Synthesis
6
  *  For Details: http://www.nceas.ucsb.edu/
7
  *
8
  *   '$Author: leinfelder $'
9
  *     '$Date: 2013-07-25 16:35:20 -0700 (Thu, 25 Jul 2013) $'
10
  * '$Revision: 8078 $'
11
  *
12
  * This program is free software; you can redistribute it and/or modify
13
  * it under the terms of the GNU General Public License as published by
14
  * the Free Software Foundation; either version 2 of the License, or
15
  * (at your option) any later version.
16
  *
17
  * This program is distributed in the hope that it will be useful,
18
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
  * GNU General Public License for more details.
21
  *
22
  * You should have received a copy of the GNU General Public License
23
  * along with this program; if not, write to the Free Software
24
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
  *
26
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
27
  * convert an XML file that is valid with respect to the eml-variable.dtd
28
  * module of the Ecological Metadata Language (EML) into an HTML format
29
  * suitable for rendering with modern web browsers.
30
-->
31
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
32

    
33
  <xsl:output method="html" encoding="UTF-8"
34
              doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
35
              doctype-system="http://www.w3.org/TR/html4/loose.dtd"
36
              indent="yes" />  
37

    
38
   <xsl:template name="nonNumericDomain">
39
     <xsl:param name="nondomainfirstColStyle"/>
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="nonNumericDomainCommon">
46
             <xsl:with-param name="nondomainfirstColStyle" select="$nondomainfirstColStyle"/>
47
            </xsl:call-template>
48
          </xsl:for-each>
49
        </xsl:when>
50
        <xsl:otherwise>
51
          <xsl:call-template name="nonNumericDomainCommon">
52
             <xsl:with-param name="nondomainfirstColStyle" select="$nondomainfirstColStyle"/>
53
           </xsl:call-template>
54
        </xsl:otherwise>
55
      </xsl:choose>
56
  </xsl:template>
57

    
58

    
59
  <xsl:template name="nonNumericDomainCommon">
60
    <xsl:param name="nondomainfirstColStyle"/>
61
    <xsl:for-each select="enumeratedDomain">
62
      <xsl:call-template name="enumeratedDomain">
63
        <xsl:with-param name="nondomainfirstColStyle" select="$nondomainfirstColStyle"/>
64
      </xsl:call-template>
65
    </xsl:for-each>
66
    <xsl:for-each select="textDomain">
67
      <xsl:call-template name="enumeratedDomain">
68
        <xsl:with-param name="nondomainfirstColStyle" select="$nondomainfirstColStyle"/>
69
      </xsl:call-template>
70
    </xsl:for-each>
71
  </xsl:template>
72

    
73
  <xsl:template name="textDomain">
74
       <xsl:param name="nondomainfirstColStyle"/>
75
       <p>Text Domain</p>
76
       <div class="control-group">
77
			<label class="control-label">Definition</label>
78
            <div class="controls controls-well">
79
            	<xsl:value-of select="definition"/>
80
            </div>
81
        </div>
82
        <xsl:for-each select="pattern">
83
          <div class="control-group">
84
			<label class="control-label">Pattern</label>
85
            <div class="controls controls-well">
86
            	<xsl:value-of select="."/>
87
            </div>
88
          </div>
89
        </xsl:for-each>
90
        <xsl:if test="source">
91
          <div class="control-group">
92
			<label class="control-label">Source</label>
93
            <div class="controls controls-well">
94
            	<xsl:value-of select="source"/>
95
            </div>
96
          </div>
97
        </xsl:if>
98
  </xsl:template>
99

    
100
  <xsl:template name="enumeratedDomain">
101
     <xsl:param name="nondomainfirstColStyle"/>
102
     <xsl:if test="codeDefinition">
103
        <p>Enumerated Domain</p>
104
        <table class="table table-striped">
105
        	<thead>
106
        		<tr>
107
        			<th>Code</th>
108
        			<th>Definition</th>
109
        			<th>Source</th>
110
        		</tr>
111
        	</thead>
112
        	<xsl:for-each select="codeDefinition">
113
		      	<tr>
114
					<td class="{$secondColStyle}"><xsl:value-of select="code"/></td>
115
					<td class="{$secondColStyle}"><xsl:value-of select="definition"/></td>
116
					<td class="{$secondColStyle}"><xsl:value-of select="source"/></td>
117
				</tr>
118
			</xsl:for-each>
119
		</table>
120
     </xsl:if>
121
     <xsl:if test="externalCodeSet">
122
     	<p>Enumerated Domain (External Set)</p>
123
        <div class="control-group">
124
			<label class="control-label">Set Name</label>
125
			<div class="controls controls-well">
126
				<xsl:value-of select="externalCodeSet/codesetName"/>
127
			</div>
128
		</div>
129
		<div class="control-group">
130
			<label class="control-label">Citation</label>
131
			<div class="controls controls-well">
132
		        <xsl:for-each select="externalCodeSet/citation">
133
		           <xsl:call-template name="citation">
134
		                      <xsl:with-param name="citationfirstColStyle" select="$nondomainfirstColStyle"/>
135
		                   </xsl:call-template>
136
		        </xsl:for-each>
137
	        </div>
138
	    </div>
139
	    <div class="control-group">
140
			<label class="control-label">URL</label>
141
			<div class="controls controls-well"> 
142
		        <xsl:for-each select="externalCodeSet/codesetURL">
143
		        	<a><xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute><xsl:value-of select="."/></a>
144
		        </xsl:for-each>
145
	        </div>
146
        </div>
147
     </xsl:if>
148
     <xsl:if test="entityCodeList">
149
        <p>Enumerated Domain (Data Object)</p>
150
        <div class="control-group">
151
			<label class="control-label">Data Object Reference</label>
152
            <div class="controls controls-well">
153
            	<xsl:value-of select="entityCodeList/entityReference"/>
154
            </div>
155
		</div>
156
       <div class="control-group">
157
			<label class="control-label">Attribute Value Reference</label>
158
            <div class="controls controls-well">
159
            	<xsl:value-of select="entityCodeList/valueAttributeReference"/>
160
            </div>
161
       </div>
162
       <div class="control-group">
163
			<label class="control-label">Attribute Definition Reference</label>
164
            <div class="controls controls-well">
165
            	<xsl:value-of select="entityCodeList/definitionAttributeReference"/>
166
            </div>
167
       </div>
168
     </xsl:if>
169

    
170
  </xsl:template>
171

    
172

    
173
</xsl:stylesheet>
(3-3/27)