Project

General

Profile

« Previous | Next » 

Revision 9786

add first pass at DCX XSLT. https://redmine.dataone.org/issues/7686

View differences:

lib/style/common/dcx/onedcx-common.xsl
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" 
3
  xmlns:dct="http://purl.org/dc/terms/" 
4
  xmlns:dcx="http://ns.dataone.org/metadata/schema/onedcx/v1.0" 
5
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
7
  xmlns="http://purl.org/dc/terms/">
8

  
9

  
10
  <xsl:template name="onedcx">
11
    <article class="container" id="Metadata">
12
    	<xsl:for-each select="*">
13
    	
14
	      <xsl:call-template name="citation"/>
15
	      <xsl:call-template name="downloads"/>
16
	      <xsl:call-template name="general"/>
17
	      <xsl:call-template name="keywords" />
18
	      <xsl:call-template name="people" />
19
	      <xsl:call-template name="geography" />
20
	      <xsl:call-template name="temporal" />
21
	      
22
    	</xsl:for-each>
23
      
24
    </article>
25
  </xsl:template>
26

  
27
  <xsl:template name="citation">
28
    <cite class="citation">
29
      <xsl:value-of select="normalize-space(dcx:dcTerms/dct:bibliographicCitation)"/>
30
    </cite>
31
  </xsl:template>
32

  
33
  <xsl:template name="downloads">
34
    <div id="downloadContents">
35
      <xsl:for-each select="dcx:simpleDc/references">
36
        <a>
37
          <xsl:attribute name="href">
38
            <xsl:value-of select="."/>
39
          </xsl:attribute>
40
          <xsl:value-of select="."/>
41
        </a>
42
      </xsl:for-each>
43
    </div>
44
  </xsl:template>
45

  
46
  <xsl:template name="general">
47
    <h4>General Content</h4>
48
    <div class="control-group">
49
      <label class="control-label">Title</label>
50
      <div class="controls controls-well">
51
        <strong>
52
          <xsl:value-of select="normalize-space(dcx:simpleDc/dct:title)"/>
53
        </strong>
54
      </div>
55
    </div>
56
    <div class="control-group">
57
      <label class="control-label">Identifier</label>
58
      <div class="controls">
59
        <div class="controls-well">
60
          <xsl:value-of select="$pid"/>
61
        </div>
62
      </div>
63
    </div>
64
    <div class="control-group">
65
      <label class="control-label">Alternate Identifier</label>
66
      <div class="controls">
67
        <div class="controls-well">
68
          <xsl:value-of select="normalize-space(dcx:simpleDc/dct:identifier)"/>
69
        </div>
70
      </div>
71
    </div>
72
    <div class="control-group">
73
      <label class="control-label">Abstract</label>
74
      <div class="controls controls-well">
75
        <div class="sectionText">
76
          <p>
77
            <xsl:value-of select="normalize-space(dcx:dcTerms/dct:abstract)"/>
78
          </p>
79
        </div>
80
      </div>
81
    </div>
82
  </xsl:template>
83

  
84
  <xsl:template name="keywords">
85
    <div class="row-fluid">
86
      <div class="control-group">
87
        <label class="control-label">Keywords</label>
88
        <div class="controls controls-well">
89
          <p>Dublin Core Terms subject</p>
90
        </div>
91
        <table class="table table-striped table-condensed">
92
          <thead>
93
            <tr><th>Keyword</th><th>Type</th></tr>
94
          </thead>
95
          <xsl:apply-templates select="dcx:simpleDc/dct:subject" />
96
        </table>
97
      </div>
98
    </div>
99
  </xsl:template>
100

  
101
  <xsl:template name="keyword" match="dct:subject">
102
    <tr>
103
      <td><xsl:value-of select="." /></td>
104
      <td></td>
105
    </tr>
106
  </xsl:template>
107

  
108
  <xsl:template name="people">
109
  </xsl:template>
110

  
111
  <xsl:template name="geography">
112
    <div class="row-fluid">
113
      <div data-content="geographicCoverage" class="row-fluid geographicCoverage">
114
        <h4>Geographic Region</h4>
115
        <div data-content="geographicDescription" class="control-group geographicDescription">
116
          <label class="control-label">Geographic Description</label>
117
          <div class="controls controls-well">
118
            <xsl:value-of select="//dcx:dcTerms/dct:spatial[not(@xsi:type='dcterms:Box')]" />
119
          </div>
120
        </div>
121
        
122
        <div data-content="boundingCoordinates" class="control-group boundingCoordinates">
123
          <label class="control-label">Bounding Coordinates</label>
124
          <xsl:for-each select="//dcx:dcTerms/dct:spatial[@xsi:type='Box']">
125
          	<xsl:call-template name="extract-coordinates"/>
126
          </xsl:for-each>
127
        </div>
128
        
129
      </div>
130
    </div>
131
  </xsl:template>
132

  
133
  <xsl:template name="extract-coordinates">
134
    <xsl:call-template name="show-coordinate">
135
      <xsl:with-param name="data" select="." />
136
      <xsl:with-param name="corner" select="'northlimit'" />
137
      <xsl:with-param name="label" select="'North'" />
138
      <xsl:with-param name="bound" select="'northBoundingCoordinate'" />
139
    </xsl:call-template>
140
    <xsl:call-template name="show-coordinate">
141
      <xsl:with-param name="data" select="." />
142
      <xsl:with-param name="corner" select="'southlimit'" />
143
      <xsl:with-param name="label" select="'South'" />
144
      <xsl:with-param name="bound" select="'southBoundingCoordinate'" />
145
    </xsl:call-template>
146
    <xsl:call-template name="show-coordinate">
147
      <xsl:with-param name="data" select="." />
148
      <xsl:with-param name="corner" select="'eastlimit'" />
149
      <xsl:with-param name="label" select="'East'" />
150
      <xsl:with-param name="bound" select="'eastBoundingCoordinate'" />
151
    </xsl:call-template>
152
    <xsl:call-template name="show-coordinate">
153
      <xsl:with-param name="data" select="." />
154
      <xsl:with-param name="corner" select="'westlimit'" />
155
      <xsl:with-param name="label" select="'West'" />
156
      <xsl:with-param name="bound" select="'westBoundingCoordinate'" />
157
    </xsl:call-template>
158
  </xsl:template>
159

  
160
  <xsl:template name="show-coordinate">
161
    <xsl:param name="data" />
162
    <xsl:param name="corner" />
163
    <xsl:param name="label" />
164
    <xsl:param name="bound" />
165
    <xsl:variable name="coord" select="substring-before(substring-after($data,concat($corner,'=')),';')" />
166
    <div data-value="{$coord}" 
167
         data-content="{$bound}" 
168
         class="control-group {$bound}">
169
      <label class="control-label"><xsl:value-of select="$label" /></label>
170
      <div class="controls controls-well"><xsl:value-of select="$coord"/><xsl:text> degrees</xsl:text></div>
171
    </div>
172
  </xsl:template>
173

  
174
  <xsl:template name="temporal">
175
    <div class="row-fluid">
176
      <div data-content="temporalCoverage" class="row-fluid temporalCoverage">
177
        <h4>Temporal Coverage</h4>
178
        <div class="control-group">
179
        <label class="control-label">Date Range</label>
180
        <div class="controls controls-well">
181
          <div class="control-group">
182
            <label class="control-label">Begin</label>
183
            <div class="controls">
184
              <div class="row-fluid">
185
                <xsl:value-of select="dcx:dcTerms/dct:temporal" />
186
              </div>
187
            </div>
188
          </div>
189
          <div class="control-group">
190
            <label class="control-label">End</label>
191
            <div class="controls">
192
              <div class="row-fluid">
193
                <xsl:value-of select="dcx:dcTerms/dct:temporal" />
194
              </div>
195
            </div>
196
          </div>
197
        </div>
198
      </div>
199
      </div>
200
    </div>
201
  </xsl:template>
202

  
203
</xsl:stylesheet>
0 204

  

Also available in: Unified diff