1<?xml version="1.0" encoding="UTF-8"?>
2<!-- This file is part of deegree, for copyright/license information, please visit http://www.deegree.org/license. -->
3<xsl:stylesheet version="1.0"
4    xmlns="http://www.opengis.net/context"
5    xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
6    xmlns:ogc="http://www.opengis.net/ogc"
7    xmlns:xlink="http://www.w3.org/1999/xlink"
8    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10    xmlns:gco="http://www.isotc211.org/2005/gco"
11    xmlns:gmd="http://www.isotc211.org/2005/gmd"
12    xmlns:srv="http://www.isotc211.org/2005/srv">
13
14	<xsl:output method="html" media-type="text/html" omit-xml-declaration="yes" encoding="UTF-8" />
15
16	<xsl:template name="OV_MD_Metadata">
17		<xsl:variable name="ServLength">
18			<xsl:value-of select="string-length($SERVICECATALOGS)" />
19		</xsl:variable>
20		<xsl:variable name="ident">
21			<xsl:value-of select="./gmd:MD_Metadata/gmd:fileIdentifier/gco:CharacterString" />
22		</xsl:variable>
23		<xsl:variable name="mdType">
24			<xsl:value-of select="./gmd:MD_Metadata/gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue" />
25		</xsl:variable>
26		<xsl:variable name="quote"><xsl:text disable-output-escaping="yes">'</xsl:text></xsl:variable>
27		<!-- <xsl:variable name="args" select="concat( $quote, $ident, $quote, ', ', $quote, $title, $quote, ', ', $quote, $CATALOG, $quote, ', ', $minx, ', ', $miny, ', ', $maxx, ', ', $maxy, ', ', $quote, $SERVICECATALOGS, $quote )" />  -->
28	    <!-- <xsl:variable name="shoppingRef" select="concat( 'javascript:addToShoppingCart( ', $args, ' );' )"/>  -->
29		<xsl:variable name="argsChildren" select="concat( $quote, $ident, $quote, ', ', $quote, $CATALOG, $quote )" />
30        <xsl:variable name="childListRef" select="concat( 'javascript:performSeriesChildrenSearch( ', $argsChildren, ' );' )"/>
31
32		<xsl:choose>
33			<xsl:when test="$mdType = 'service'">
34				<xsl:variable name="title">
35					<xsl:value-of select="./gmd:MD_Metadata/./gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString" />
36				</xsl:variable>
37				<xsl:variable name="minx">
38					<xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/srv:SV_ServiceIdentification/srv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:westBoundLongitude/gco:Decimal" />
39				</xsl:variable>
40				<xsl:variable name="maxx">
41					<xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/srv:SV_ServiceIdentification/srv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:eastBoundLongitude/gco:Decimal" />
42				</xsl:variable>
43				<xsl:variable name="miny">
44					<xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/srv:SV_ServiceIdentification/srv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:southBoundLatitude/gco:Decimal" />
45				</xsl:variable>
46				<xsl:variable name="maxy">
47					<xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/srv:SV_ServiceIdentification/srv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:northBoundLatitude/gco:Decimal" />
48				</xsl:variable>
49				<!-- contents -->
50				<table class="md">
51					<!--
52                    <tr>
53						<td class="key">Topic Category</td>
54						<td class="val"><xsl:value-of select="$topicCategory" /></td>
55					</tr>
56                    -->
57					<tr>
58						<td class="key">Identifier:</td>
59						<td class="val"><xsl:value-of select="$ident" /></td>
60					</tr>
61					<tr>
62						<td class="key">Title:</td>
63						<td class="val"><xsl:value-of select="$title" /></td>
64					</tr>
65					<tr>
66						<td class="key">Catalogues:</td>
67						<xsl:choose>
68							<xsl:when test="$ServLength &gt; 0">
69								<td class="val"><xsl:value-of select="$SERVICECATALOGS" /></td>
70							</xsl:when>
71							<xsl:otherwise>
72								<td class="val">no Service-Catalogue available</td>
73							</xsl:otherwise>
74						</xsl:choose>
75					</tr>
76					<tr>
77						<td class="key">Metadata Type:</td>
78						<td class="val"><xsl:value-of select="$mdType" /></td>
79					</tr>
80				</table>
81			</xsl:when>
82
83			<xsl:otherwise>
84			    <xsl:variable name="topicCategory">
85			        <xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:topicCategory/gmd:MD_TopicCategoryCode" />
86		        </xsl:variable>
87				<xsl:variable name="title">
88					<xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString" />
89				</xsl:variable>
90				<xsl:variable name="minx">
91					<xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:westBoundLongitude/gco:Decimal" />
92				</xsl:variable>
93				<xsl:variable name="maxx">
94					<xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:eastBoundLongitude/gco:Decimal" />
95				</xsl:variable>
96				<xsl:variable name="miny">
97					<xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:southBoundLatitude/gco:Decimal" />
98				</xsl:variable>
99				<xsl:variable name="maxy">
100					<xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_GeographicBoundingBox/gmd:northBoundLatitude/gco:Decimal" />
101				</xsl:variable>
102				<xsl:variable name="keyWords">
103                    <xsl:value-of select="./gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword/gco:CharacterString" />
104                </xsl:variable>
105				<!-- contents -->
106				<table class="md" bgcolor="red">
107					<tr>
108						<td class="key">Topic Category:</td>
109						<td class="val">
110    						<xsl:variable name="counter" >
111                                <xsl:value-of select="count(./gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:topicCategory/gmd:MD_TopicCategoryCode)" />
112    						</xsl:variable>
113					        <xsl:for-each select="./gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:topicCategory/gmd:MD_TopicCategoryCode">
114					        	<xsl:value-of select="text()" />
115					        	<xsl:if test="(position() &gt;= 1) and (position() &lt; $counter)">, </xsl:if>
116				        	</xsl:for-each>
117						</td>
118					</tr>
119					<tr>
120						<td class="key">Identifier:</td>
121						<td class="val"><xsl:value-of select="$ident" /></td>
122					</tr>
123					<tr>
124						<td class="key">Title:</td>
125						<td class="val"><xsl:value-of select="$title" /></td>
126					</tr>
127					<tr>
128						<td class="key">Service-Catalogues:</td>
129						<xsl:choose>
130							<xsl:when test="$ServLength &gt; 0">
131								<td class="val"><xsl:value-of select="$SERVICECATALOGS" /></td>
132							</xsl:when>
133							<xsl:otherwise>
134								<td class="val">no Service-Catalogue available</td>
135							</xsl:otherwise>
136						</xsl:choose>
137					</tr>
138					<tr>
139						<td class="key">Metadata Type:</td>
140						<td class="val"><xsl:value-of select="$mdType" /></td>
141					</tr>
142					<tr>
143                        <td class="key">Keywords:</td>
144                        <td class="val"><xsl:value-of select="$keyWords"/></td>
145                    </tr>
146				</table>
147			</xsl:otherwise>
148		</xsl:choose>
149
150		<!-- control elements -->
151		<table class="spacetop" width="500px">
152			<tr>
153				<td width="30%" align="middle">
154					<a class="menu" href="javascript:getMetadataDetails();"><!-- <img src="./images/csw_details.gif" border="0" /> -->DETAILS</a>
155				</td>
156				<!--
157                <td width="40%" align="middle">
158					<xsl:choose>
159					<xsl:when test="$ServLength &gt; 0">
160					<a class="menu" href="{$shoppingRef}"><img src="./images/csw_add_to_choice.gif" border="0"/> ADD TO SHOPPING CART</a>
161					</xsl:when>
162					<xsl:otherwise>
163					<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
164					</xsl:otherwise>
165					</xsl:choose>
166				</td>
167                -->
168				<td width="30%" align="middle">
169					<a class="menu" href="javascript:window.close();"><!-- <img src="./images/csw_close.gif" border="0" /> -->CLOSE</a>
170				</td>
171                <td>
172                    <xsl:choose>
173                        <xsl:when test="$mdType='series'"><a href="{$childListRef}">CHILDREN</a></xsl:when>
174                	</xsl:choose>
175            	</td>
176			</tr>
177		</table>
178	</xsl:template>
179</xsl:stylesheet>
180