<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>

<!-- Map Viewer (Third Edition) by Howie Sternberg at howies@snet.net. Map Viewer is placed in the public domain and is "Freeware". Map Viewer may be freely used and redistributed, is provided "AS-IS" without warranty of any kind, and there is no technical support provided. --> 

<!-- input parameters and defauts --> 
<xsl:param name="currentMapServerUrl" select="'none'"/>
<xsl:param name="currentMapService" select="'none'"/>
<xsl:param name="currentMapTitle" select="'none'"/>

<!-- Return delimeted string of search options (Find function) for a given map service. See mapviewer.xml. Delimeter is vertical bar: | -->
<xsl:template match="/">
<xsl:for-each select="mapviewer/servers/server/mapservices/mapservice/map">
	<xsl:variable name="mapServerUrl">
		<xsl:value-of select="../../../@url"></xsl:value-of>
	</xsl:variable>
	<xsl:variable name="mapService">
		<xsl:value-of select="../@name"></xsl:value-of>
	</xsl:variable>
	<xsl:variable name="mapTitle">
		<xsl:value-of select="@title"></xsl:value-of>
	</xsl:variable>
	<xsl:choose>
		<xsl:when test="$currentMapServerUrl = $mapServerUrl">
			<xsl:choose>
				<xsl:when test="$currentMapService = $mapService">
					<xsl:choose>
						<xsl:when test="$currentMapTitle = $mapTitle">				
							<xsl:for-each select="search/choice">							
								<xsl:sort select="@title" order="ascending" data-type="text"/>
								<xsl:value-of select="@title"/>
								<text>|</text>
								<xsl:value-of select="@layerid"/>
								<text>|</text>
								<xsl:value-of select="@searchfield"/>
								<text>*</text>
							</xsl:for-each>
						</xsl:when>
					</xsl:choose>
				</xsl:when>
			</xsl:choose>
		</xsl:when>
	</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>