Downloads/xmlstyle: ISO19115-stylesheet.xsl

File ISO19115-stylesheet.xsl, 35.1 KB (added by mark1, 10 years ago)

xsl style sheet for viewing ARSF hyperspectral xml files

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:exslt="http://exslt.org/common" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="exslt msxsl">
3   <xsl:output method="html" doctype-public="XSLT-compat" encoding="UTF-8" />
4
5   <msxsl:script language="JScript" implements-prefix="exslt">
6      this['node-set'] = function (x) {
7      return x;
8      }
9   </msxsl:script>
10
11   <xsl:template match="gmd:MD_Metadata">
12
13      <html>
14         <link rel="stylesheet" type="text/css" href="ISO19115-css.css" />
15         <head>
16            <title>
17               <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString" />
18            </title>
19         </head>
20         <body>
21            <!-- Store in variable so that a second pass can be done to count and number the bands -->
22            <xsl:variable name="firstPass">
23               <div class="main">
24                  <div class="title">
25                     <h2>
26                        <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString" />
27                     </h2>
28                  </div>
29                  <div class="section metaDataSection">
30                     <table class="infoGroup">
31                        <tr>
32                           <td>Metadata Standard:</td>
33                           <td>
34                              <xsl:value-of select="gmd:metadataStandardName/gco:CharacterString" />
35                           </td>
36                        </tr>
37                        <tr>
38                           <td>Version:</td>
39                           <td>
40                              <xsl:value-of select="gmd:metadataStandardVersion/gco:CharacterString" />
41                           </td>
42                        </tr>
43                        <tr>
44                           <td>Date Stamp:</td>
45                           <td>
46                              <xsl:call-template name="parseDateTime">
47                                 <xsl:with-param name="dateTime" select="gmd:dateStamp/gco:DateTime" />
48                              </xsl:call-template>
49                           </td>
50                        </tr>
51                        <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date">
52                           <tr>
53                              <td>
54                                 <xsl:call-template name="formatTitles">
55                                    <xsl:with-param name="text" select="normalize-space(concat(gmd:dateType/gmd:CI_DateTypeCode,' date:'))" />
56                                 </xsl:call-template>
57                              </td>
58                              <td>
59                                 <xsl:call-template name="parseDateTime">
60                                    <xsl:with-param name="dateTime" select="gmd:date/gco:DateTime" />
61                                 </xsl:call-template>
62                              </td>
63                           </tr>
64                        </xsl:for-each>
65                        <tr>
66                           <td>Raw Filename:</td>
67                           <td>
68                              <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:RS_Identifier/gmd:code/gco:CharacterString" />
69                           </td>
70                        </tr>
71                        <tr>
72                           <td>Abstract:</td>
73                           <td>
74                              <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:abstract/gco:CharacterString" />
75                           </td>
76                        </tr>
77                        <tr>
78                           <td>Purpose:</td>
79                           <td>
80                              <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:purpose/gco:CharacterString" />
81                           </td>
82                        </tr>
83                     </table>
84                  </div>
85
86
87                  <div class="infoGroup piSection">
88                     <h3>Principal Investigator</h3>
89                     <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty/gmd:individualName/gco:CharacterString" />
90                     <h3>File Identifier</h3>
91                     <xsl:value-of select="gmd:fileIdentifier/gco:CharacterString" />
92                  </div>
93
94
95                  <div class="infoGroup flightDetailsSection">
96                     <h3>Flight Details</h3>
97                     <xsl:value-of select="gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:lineage/gmd:LI_Lineage/gmd:statement/gco:CharacterString" />
98                     <table class="infoTable">
99                        <tr>
100                           <td>Topic Category:</td>
101                           <td>
102                              <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:topicCategory/gmd:MD_TopicCategoryCode" />
103                           </td>
104                        </tr>
105                        <tr>
106                           <td>Area:</td>
107                           <td>
108                              <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:description/gco:CharacterString" />
109                           </td>
110                        </tr>
111                        <tr>
112                           <td>Longitude Bounds:</td>
113                           <td>
114                              <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:westBoundLongitude/gco:Decimal" />
115                              <xsl:text>, </xsl:text>
116                              <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:eastBoundLongitude/gco:Decimal" />
117                           </td>
118                           <td>
119                              <br />
120                           </td>
121                        </tr>
122                        <tr>
123                           <td>Latitude Bounds:</td>
124                           <td>
125                              <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:southBoundLatitude/gco:Decimal" />
126                              <xsl:text>, </xsl:text>
127                              <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:northBoundLatitude/gco:Decimal" />
128                           </td>
129                        </tr>
130                        <tr>
131                           <td>Flight start time:</td>
132                           <td>
133                              <xsl:call-template name="parseDateTime">
134                                 <xsl:with-param name="dateTime" select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:beginPosition" />
135                              </xsl:call-template>
136                           </td>
137                        </tr>
138                        <tr>
139                           <td>Flight end time:</td>
140                           <td>
141                              <xsl:call-template name="parseDateTime">
142                                 <xsl:with-param name="dateTime" select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:temporalElement/gmd:EX_TemporalExtent/gmd:extent/gml:TimePeriod/gml:endPosition" />
143                              </xsl:call-template>
144                           </td>
145                        </tr>
146                        <tr>
147                           <td>
148                              <xsl:call-template name="PreserveLineBreaks">
149                                 <xsl:with-param name="text" select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:credit/gco:CharacterString" />
150                              </xsl:call-template>
151                           </td>
152                        </tr>
153                     </table>
154                  </div>
155                  <div class="infoGroup contactsSection clearfix">
156                     <h3>Contacts</h3>
157                     <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:pointOfContact/gmd:CI_ResponsibleParty">
158                        <xsl:if test="not(contains(gmd:role/gmd:CI_RoleCode, 'principalInvestigator'))">
159                           <div class="infoGroup floatTable">
160                              <h4>
161                                 <xsl:call-template name="formatTitles">
162                                    <xsl:with-param name="text" select="gmd:role/gmd:CI_RoleCode" />
163                                 </xsl:call-template>
164                              </h4>
165                              <xsl:value-of select="gmd:organisationName/gco:CharacterString" />
166                              <br />
167                              <xsl:value-of select="gmd:contactInfo/gmd:CI_Contact/gmd:phone/gmd:CI_Telephone/gmd:voice/gco:CharacterString" />
168                              <br />
169                              <address>
170                                 <xsl:for-each select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:deliveryPoint">
171                                    <xsl:value-of select="gco:CharacterString" />
172                                    <br />
173                                 </xsl:for-each>
174                                 <xsl:value-of select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:city/gco:CharacterString" />
175                                 <br />
176                                 <xsl:value-of select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:administrativeArea/gco:CharacterString" />
177                                 <br />
178                                 <xsl:value-of select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:postalCode/gco:CharacterString" />
179                                 <br />
180                                 <xsl:value-of select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:country/gco:CharacterString" />
181                              </address>
182                              <xsl:variable name="emailAddress" select="gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress/gco:CharacterString" />
183                              <a href="mailto:{$emailAddress}">
184                                 <xsl:value-of select="$emailAddress" />
185                              </a>
186                           </div>
187                        </xsl:if>
188                     </xsl:for-each>
189                  </div>
190
191
192
193                  <div class="infoGroup dataQualitySection">
194                     <h3>Data Quality</h3>
195                     <xsl:for-each select="gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report/gmd:DQ_DomainConsistency/gmd:result/gmd:DQ_ConformanceResult">
196                        <xsl:if test="contains(gmd:specification/gmd:CI_Citation/gmd:title/gco:CharacterString, 'Hyperspectral')">
197                           <xsl:value-of select="gmd:specification/gmd:CI_Citation/gmd:title/gco:CharacterString" />
198                           <br />
199                           <xsl:call-template name="formatTitles">
200                              <xsl:with-param name="text" select="normalize-space(concat(gmd:specification/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:dateType,'date:'))" />
201                           </xsl:call-template>
202                           <xsl:call-template name="parseDateTime">
203                              <xsl:with-param name="dateTime" select="gmd:specification/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date" />
204                           </xsl:call-template>
205                           <br />
206                           <xsl:value-of select="gmd:explanation/gco:CharacterString" />
207                           <xsl:text>:</xsl:text>
208                           <xsl:value-of select="gmd:pass/gco:Boolean" />
209                        </xsl:if>
210                     </xsl:for-each>
211                  </div>
212
213
214                  <div class="infoGroup GemetSection">
215                     <h3>GEMET Theme</h3>
216                     <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:thesaurusName/gmd:CI_Citation/gmd:title/gco:CharacterString" />
217                     <br />
218                     <xsl:call-template name="formatTitles">
219                        <xsl:with-param name="text" select="normalize-space(concat(gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:thesaurusName/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:dateType/gmd:CI_DateTypeCode,'date:'))" />
220                     </xsl:call-template>
221                     <xsl:text> </xsl:text>
222                     <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:thesaurusName/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date/gco:Date" />
223                  </div>
224
225
226                  <div class="infoGroup DistributionSection">
227                     <h3>Distribution Information</h3>
228                     <table>
229                        <tr>
230                           <td>Format:</td>
231                           <td>
232                              <xsl:value-of select="gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:name/gco:CharacterString" />
233                           </td>
234                        </tr>
235                        <tr>
236                           <td>Version:</td>
237                           <td>
238                              <xsl:value-of select="gmd:distributionInfo/gmd:MD_Distribution/gmd:distributionFormat/gmd:MD_Format/gmd:version/gco:CharacterString" />
239                           </td>
240                        </tr>
241                        <tr>
242                           <td>Online Resource:</td>
243                           <td>
244                              <xsl:value-of select="gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:linkage/gmd:URL" />
245                           </td>
246                        </tr>
247                     </table>
248                  </div>
249
250
251                  <!-- Supplemental section -->
252                  <xsl:if test="/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:supplementalInformation/gco:CharacterString">
253                     <h3>Flightline Details</h3>
254                     <xsl:call-template name="splitWallOfText">
255                        <xsl:with-param name="text" select="/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:supplementalInformation/gco:CharacterString" />
256                     </xsl:call-template>
257                     <!-- print the parts of the wall 'o text that are stored as comments instead of being in the main string -->
258                     <div class="infoGroup">
259                        <table>
260                           <h3>Comments:</h3>
261                           <xsl:for-each select=".//comment()">
262                              <tr>
263                                 <td>
264                                    <xsl:value-of select="." />
265                                 </td>
266                              </tr>
267                           </xsl:for-each>
268                        </table>
269                     </div>
270
271                  </xsl:if>
272                  <div class="infoGroup processingSection">
273                     <h3>Processing</h3>
274                     <xsl:for-each select="gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:lineage/gmd:LI_Lineage/gmd:statement">
275                        <xsl:value-of select="gco:CharacterString" />
276                        <br />
277                     </xsl:for-each>
278                     <br />
279                     <xsl:for-each select="gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:lineage/gmd:LI_Lineage/gmd:processStep/gmd:LI_ProcessStep/gmd:description">
280                        <xsl:value-of select="gco:CharacterString" />
281                        <br />
282                        <br />
283                     </xsl:for-each>
284                  </div>
285               </div>
286            </xsl:variable>
287            <!-- second pass to count and number the bands -->
288            <xsl:apply-templates select="exslt:node-set($firstPass)" mode="secondPass" />
289         </body>
290         <footer>
291            <div class="legalSection">
292               <xsl:for-each select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints">
293
294                  <xsl:value-of select="gmd:useLimitation/gco:CharacterString" />
295                  <br />
296                  <br />
297               </xsl:for-each>
298               <xsl:value-of select="gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_Constraints/gmd:useLimitation/gco:CharacterString" />
299            </div>
300         </footer>
301      </html>
302   </xsl:template>
303
304
305
306   <!-- second pass to count and number the bands -->
307   <xsl:template match="*" mode="secondPass">
308      <xsl:copy>
309         <xsl:copy-of select="@*" />
310         <xsl:apply-templates mode="secondPass" />
311      </xsl:copy>
312   </xsl:template>
313
314   <xsl:template match="div[contains(@class,'bandTable')]" mode="secondPass">
315      <div>
316         <xsl:attribute name="class">
317            <xsl:value-of select="@class" />
318         </xsl:attribute>
319         <table>
320            <th>
321               <xsl:text>Band: </xsl:text>
322               <xsl:value-of select="count(preceding-sibling::div)" />
323            </th>
324            <xsl:copy-of select="current()/*/*" />
325         </table>
326      </div>
327   </xsl:template>
328
329   <xsl:template name="PreserveLineBreaks">
330      <xsl:param name="text" />
331      <xsl:choose>
332         <xsl:when test="contains($text,'&#xA;')">
333            <xsl:choose>
334               <xsl:when test="':'=substring(substring-before($text,'&#xA;'), string-length(substring-before($text,'&#xA;')) - string-length(':') + 1)">
335                  <b>
336                     <xsl:call-template name="formatTitles">
337                        <xsl:with-param name="text" select="normalize-space(substring-before($text,'&#xA;'))" />
338                     </xsl:call-template>
339                  </b>
340               </xsl:when>
341               <xsl:otherwise>
342                  <xsl:value-of select="substring-before($text,'&#xA;')" />
343               </xsl:otherwise>
344            </xsl:choose>
345            <!--xsl:if test="(contains(substring-before($text,'&#xA;'), ''))" -->
346            <br />
347            <!--/xsl:if -->
348            <xsl:if test="contains(substring(substring-after($text,'&#xA;'),1,30),'band:')">
349               <br />
350            </xsl:if>
351            <xsl:call-template name="PreserveLineBreaks">
352               <xsl:with-param name="text" select="substring-after($text,'&#xA;')" />
353            </xsl:call-template>
354         </xsl:when>
355         <xsl:otherwise>
356            <xsl:value-of select="$text" />
357         </xsl:otherwise>
358      </xsl:choose>
359   </xsl:template>
360
361
362
363   <xsl:template name="TabledLineBreaks">
364      <xsl:param name="text" />
365      <xsl:choose>
366         <xsl:when test="not(boolean($text))">
367         </xsl:when>
368         <!-- fix for final delimiter showing up in document when delimiting by "band:" -->
369         <xsl:when test="$text = 'band:'">
370         </xsl:when>
371
372         <!-- split into paragraphs and wrap each of them in a table -->
373         <xsl:when test="contains($text,'&#xA;&#xA;')"><!-- string contains more than one paragraph -->
374            <div class="infoGroup floatGroup">
375               <table>
376                  <xsl:call-template name="TabledLineBreaks">
377                     <xsl:with-param name="text" select="substring-before($text,'&#xA;&#xA;')" />
378                  </xsl:call-template>
379               </table>
380            </div>
381            <!-- recurse and process the remainder of the string. -->
382            <xsl:call-template name="TabledLineBreaks">
383               <xsl:with-param name="text" select="substring-after($text,'&#xA;&#xA;')" />
384            </xsl:call-template>
385         </xsl:when>
386
387
388
389         <!-- do the same, but using a different check as bands have no empty lines between them. -->
390         <xsl:when test="contains(substring-before($text,'&#xA;'),'band:')">
391            <div class="infoGroup bandTable">
392               <table>
393                  <!-- process band section -->
394                  <xsl:choose>
395                     <xsl:when test="boolean(substring-before(substring-after($text,'&#xA;'),'band:'))">
396                        <xsl:call-template name="TabledLineBreaks">
397                           <xsl:with-param name="text" select="substring-before(substring-after($text,'&#xA;'),'band:')" />
398                        </xsl:call-template>
399                     </xsl:when>
400                     <xsl:otherwise>
401                        <xsl:call-template name="TabledLineBreaks">
402                           <xsl:with-param name="text" select="substring-after($text,'&#xA;')" />
403                        </xsl:call-template>
404                     </xsl:otherwise>
405                  </xsl:choose>
406               </table>
407            </div>
408            <!-- process rest of string -->
409
410            <xsl:call-template name="TabledLineBreaks">
411               <xsl:with-param name="text" select="concat('band:',substring-after(substring-after($text,'band:'),'band:'))" />
412            </xsl:call-template>
413         </xsl:when>
414
415
416         <xsl:otherwise><!-- string is a single paragraph -->
417            <xsl:choose>
418               <xsl:when test="contains($text,'&#xA;')"><!-- if there are multiple lines -->
419                  <!-- check if the following line contains the units -->
420                  <xsl:choose>
421                     <xsl:when test="contains(substring-before(substring-after($text,'&#xA;'),'&#xA;'),'unit:') or contains(substring-before(substring-after($text,'&#xA;'),'&#xA;'),'units:')">
422                        <xsl:variable name="unit" select="substring-before(substring-after(substring-after($text,'&#xA;'),':'),'&#xA;')" />
423                        <xsl:call-template name="TabledLineBreaks">
424                           <xsl:with-param name="text" select="concat(normalize-space(substring-before($text,'&#xA;')),$unit)" />
425                        </xsl:call-template>
426                        <!-- recurse and process the remainder of the string. -->
427                        <xsl:call-template name="TabledLineBreaks">
428                           <xsl:with-param name="text" select="substring-after(substring-after($text,'&#xA;'),'&#xA;')" />
429                        </xsl:call-template>
430                     </xsl:when>
431                     <xsl:otherwise>
432                        <!-- Take everything before the first line break and recurse. -->
433                        <xsl:call-template name="TabledLineBreaks">
434                           <xsl:with-param name="text" select="normalize-space(substring-before($text,'&#xA;'))" />
435                        </xsl:call-template>
436                        <!-- recurse and process the remainder of the string. -->
437                        <xsl:call-template name="TabledLineBreaks">
438                           <xsl:with-param name="text" select="substring-after($text,'&#xA;')" />
439                        </xsl:call-template>
440                     </xsl:otherwise>
441                  </xsl:choose>
442
443               </xsl:when>
444               <xsl:otherwise><!-- If there is only a single line. -->
445                  <xsl:if test="boolean(normalize-space($text))">
446                     <xsl:if test="*//comment()">
447
448                        <xsl:value-of disable-output-escaping="yes" select="substring-before(substring-after($text,'&lt;'),'&gt;')" />
449                     </xsl:if>
450                     <xsl:choose>
451                        <!-- This line was a pain to isolate, I haven't been able to find a better way than just checking for it manually. A more general way would save duplicating so much code. -->
452                        <xsl:when test="contains($text,'synchronizationProblem:')">
453                           <div class="infoGroup floatGroup">
454                              <tr>
455                                 <td>
456                                    <xsl:call-template name="formatTitles">
457                                       <xsl:with-param name="text" select="concat(normalize-space(substring-before($text,':')),':')" />
458                                    </xsl:call-template>
459                                 </td>
460                                 <td>
461                                    <xsl:call-template name="specifyUnits">
462                                       <xsl:with-param name="measurement" select="substring-before($text,':')" />
463                                       <xsl:with-param name="value" select="substring-after($text,':')" />
464                                       <xsl:with-param name="text" select="substring-after($text,':')" />
465                                    </xsl:call-template>
466                                 </td>
467                              </tr>
468                           </div>
469                        </xsl:when>
470                        <!-- If ":" is at the end of the string, it's a title, so format and print it -->
471                        <xsl:when test="contains($text,':') and not(boolean(substring-after($text,':')))">
472                           <th colspan="2">
473                              <xsl:call-template name="formatTitles">
474                                 <xsl:with-param name="text" select="normalize-space($text)" />
475                              </xsl:call-template>
476                           </th>
477                        </xsl:when>
478                        <xsl:otherwise><!-- It's a key+value pair -->
479                           <tr>
480                              <td>
481                                 <xsl:call-template name="formatTitles">
482                                    <xsl:with-param name="text" select="concat(normalize-space(substring-before($text,':')),':')" />
483                                 </xsl:call-template>
484                              </td>
485                              <td>
486                                 <xsl:call-template name="specifyUnits">
487                                    <xsl:with-param name="measurement" select="substring-before($text,':')" />
488                                    <xsl:with-param name="value" select="substring-after($text,':')" />
489                                    <xsl:with-param name="text" select="substring-after($text,':')" />
490                                 </xsl:call-template>
491                              </td>
492                           </tr>
493                        </xsl:otherwise>
494                     </xsl:choose>
495                  </xsl:if>
496               </xsl:otherwise>
497            </xsl:choose>
498         </xsl:otherwise>
499      </xsl:choose>
500   </xsl:template>
501
502
503   <!-- splits the bands list off from the string containing supplimental info. -->
504   <xsl:template name="splitWallOfText">
505      <xsl:param name="text" />
506      <div class="infoGroup supplimentalSection clearfix">
507         <xsl:call-template name="TabledLineBreaks">
508            <xsl:with-param name="text" select="substring-before($text,'band:')" />
509         </xsl:call-template>
510      </div>
511      <div class="infoGroup bandsSection clearfix">
512         <h3>Band details:</h3>
513         <br />
514         <xsl:call-template name="TabledLineBreaks">
515            <xsl:with-param name="text" select="concat('band:',substring-after($text,'band:'))" />
516         </xsl:call-template>
517      </div>
518   </xsl:template>
519
520   <!-- Replaces names with properly spaced and capitalised versions -->
521   <xsl:template name="formatTitles">
522      <xsl:param name="text" />
523      <xsl:choose>
524         <xsl:when test="contains($text,'pointOfContact')">
525            <xsl:text>Point of contact</xsl:text>
526         </xsl:when>
527         <xsl:when test="contains($text,'originator')">
528            <xsl:text>Originator</xsl:text>
529         </xsl:when>
530         <xsl:when test="contains($text,'sensorSpecifics:')">
531            <xsl:text>Sensor specifics:</xsl:text>
532         </xsl:when>
533         <xsl:when test="contains($text,'type:')">
534            <xsl:text>Type:</xsl:text>
535         </xsl:when>
536         <xsl:when test="contains($text,'pixelsInLine:')">
537            <xsl:text>Pixels in line:</xsl:text>
538         </xsl:when>
539         <xsl:when test="contains($text,'sensorParameters:')">
540            <xsl:text>Sensor Parameters:</xsl:text>
541         </xsl:when>
542         <xsl:when test="contains($text,'radiometricCalibration:')">
543            <xsl:text>Radiometric calibration:</xsl:text>
544         </xsl:when>
545         <xsl:when test="contains($text,'spectralCalibration:')">
546            <xsl:text>Spectral calibration:</xsl:text>
547         </xsl:when>
548         <xsl:when test="contains($text,'aquisitionInfo:')">
549            <xsl:text>Aquisition info:</xsl:text>
550         </xsl:when>
551         <xsl:when test="contains($text,'software:')">
552            <xsl:text>Software:</xsl:text>
553         </xsl:when>
554         <xsl:when test="contains($text,'maximumScanAngle:')">
555            <xsl:text>Maximum scan angle:</xsl:text>
556         </xsl:when>
557         <xsl:when test="contains($text,'numberOfSpectralBands:')">
558            <xsl:text>Number of spectral Bands:</xsl:text>
559         </xsl:when>
560         <xsl:when test="contains($text,'calibrationLaboratory:')">
561            <xsl:text>Calibration lab:</xsl:text>
562         </xsl:when>
563         <xsl:when test="contains($text,'radianceUnits:')">
564            <xsl:text>Radiance units:</xsl:text>
565         </xsl:when>
566         <xsl:when test="contains($text,'scanFrequency:')">
567            <xsl:text>Scan Frequency:</xsl:text>
568         </xsl:when>
569         <xsl:when test="contains($text,'integrationTime:')">
570            <xsl:text>Intergration time:</xsl:text>
571         </xsl:when>
572         <xsl:when test="contains($text,'spectralBinning:')">
573            <xsl:text>Spectral binning:</xsl:text>
574         </xsl:when>
575         <xsl:when test="contains($text,'spatialBinning:')">
576            <xsl:text>Spacial binning:</xsl:text>
577         </xsl:when>
578         <xsl:when test="contains($text,'calibrationFilename:')">
579            <xsl:text>Calibration filename:</xsl:text>
580         </xsl:when>
581         <xsl:when test="contains($text,'dateOfCalibrationFile:')">
582            <xsl:text>Date of calibration file:</xsl:text>
583         </xsl:when>
584         <xsl:when test="contains($text,'navigationUnit:')">
585            <xsl:text>Navigation unit:</xsl:text>
586         </xsl:when>
587         <xsl:when test="contains($text,'pixelSizeX:')">
588            <xsl:text>Pixel size X:</xsl:text>
589         </xsl:when>
590         <xsl:when test="contains($text,'pixelSizeY:')">
591            <xsl:text>Pixel size Y:</xsl:text>
592         </xsl:when>
593         <xsl:when test="contains($text,'dateOfCalibrationFile:')">
594            <xsl:text>Date of calibration file:</xsl:text>
595         </xsl:when>
596         <xsl:when test="contains($text,'altitudeAboveWGS84Ellipsoid:')">
597            <xsl:text>Altitude above WGS84 elipsoid:</xsl:text>
598         </xsl:when>
599         <xsl:when test="contains($text,'angleToTrueNorth:')">
600            <xsl:text>Angle to true north:</xsl:text>
601         </xsl:when>
602         <xsl:when test="contains($text,'planeSpeed:')">
603            <xsl:text>Plane speed:</xsl:text>
604         </xsl:when>
605         <xsl:when test="contains($text,'landCover:')">
606            <xsl:text>Land cover:</xsl:text>
607         </xsl:when>
608         <xsl:when test="contains($text,'softwareDescription:')">
609            <br />
610            <xsl:text>Type:</xsl:text>
611         </xsl:when>
612         <xsl:when test="contains($text,'softwareName:')">
613            <xsl:text>Name:</xsl:text>
614         </xsl:when>
615         <xsl:when test="contains($text,'softwareVersion:')">
616            <xsl:text>Version:</xsl:text>
617         </xsl:when>
618         <xsl:when test="contains($text,'synchronizationProblem:')">
619            <xsl:text>Synchronisation problem:</xsl:text>
620         </xsl:when>
621         <xsl:when test="contains($text,'centreWavelength:')">
622            <xsl:text>Centre wavelength:</xsl:text>
623         </xsl:when>
624         <xsl:when test="contains($text,'dem:')">
625            <xsl:text>DEM:</xsl:text>
626         </xsl:when>
627         <xsl:when test="contains($text,'instrument:')">
628            <xsl:text>Instrument:</xsl:text>
629         </xsl:when>
630         <xsl:when test="contains($text,'platform:')">
631            <xsl:text>Platform:</xsl:text>
632         </xsl:when>
633         <xsl:when test="contains($text,'creation date:')">
634            <xsl:text>Creation date:</xsl:text>
635         </xsl:when>
636         <xsl:when test="contains($text,'publication date:')">
637            <xsl:text>Publication date:</xsl:text>
638         </xsl:when>
639         <xsl:when test="contains($text,'filename:')">
640            <xsl:text>File name:</xsl:text>
641         </xsl:when>
642         <xsl:when test="contains($text,'source:')">
643            <xsl:text>Source:</xsl:text>
644         </xsl:when>
645         <xsl:when test="contains($text,'units:')">
646            <xsl:text>Units:</xsl:text>
647         </xsl:when>
648         <xsl:when test="contains($text,'base:')">
649            <xsl:text>Base:</xsl:text>
650         </xsl:when>
651         <xsl:when test="contains($text,'bandwidth:')">
652            <xsl:text>Bandwidth:</xsl:text>
653         </xsl:when>
654         <xsl:otherwise>
655            <xsl:value-of select="normalize-space($text)" />
656         </xsl:otherwise>
657      </xsl:choose>
658   </xsl:template>
659
660   <!-- adds units for measurementswhich don't specify them in the xml -->
661   <xsl:template name="specifyUnits">
662      <xsl:param name="measurement" />
663      <xsl:param name="value" />
664      <xsl:choose>
665         <xsl:when test="contains($measurement,'FOV')">
666            <xsl:value-of select="concat($value,'°')" />
667         </xsl:when>
668         <xsl:when test="contains($measurement,'bandwidth')">
669            <xsl:value-of select="concat($value,'')" /><!-- add in the units here once it's known what they are. -->
670         </xsl:when>
671         <xsl:when test="contains($measurement,'maximumScanAngle')">
672            <xsl:value-of select="concat($value,'°')" />
673         </xsl:when>
674         <xsl:otherwise>
675            <xsl:value-of select="$value" />
676         </xsl:otherwise>
677      </xsl:choose>
678   </xsl:template>
679
680   <xsl:template name="parseDateTime">
681      <xsl:param name="dateTime" />
682      <time datetime="{substring($dateTime,0,20)}Z">
683         <xsl:choose>
684            <xsl:when test="contains($dateTime,'T')">
685               <xsl:value-of select="substring-before($dateTime,'T')" />
686               <xsl:text>&#160; </xsl:text>
687               <xsl:value-of select="substring-after($dateTime,'T')" />
688            </xsl:when>
689            <xsl:otherwise>
690               <xsl:value-of select="$dateTime" />
691            </xsl:otherwise>
692         </xsl:choose>
693      </time>
694   </xsl:template>
695</xsl:stylesheet>