<xsl:stylesheet version="1.0"   
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:svg="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:gmwmsvg="http://www.intergraph.com/GeoMedia/wmsvg" 
>
<xsl:include href="Functions.xsl"/>
<xsl:include href="Elements.xsl"/>

<!--
  Help on customizing GeoMedia WebMap SVG output:
  include your custom xsl file reference here  
  (outside of the comment markers), for example:
  
<xsl:include href="Custom.xsl"/>
  
  See additional comments below, and the file 
  Custom.xsl on how to format your custom xsl file.
-->

<xsl:param name="gwmtooltipfont" select="'Arial'"/>

<xsl:output method="xml"  indent="yes" cdata-section-elements="svg:style" encoding="UTF-8"/>

<xsl:template match="/">
	<xsl:apply-templates/>
</xsl:template>


<xsl:variable name="HasLogo" select="svg:svg/svg:g[1]/svg:g[@id='_GWMLogo']"/>
<xsl:template match="@*|node()">
  <xsl:choose>
    <xsl:when test="@id='_GWMLogo'">
      <xsl:call-template name="GWMSelectedLayer"/>
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:when>
    <xsl:when test="@id='_GWMAll'">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
        <xsl:if test="count($HasLogo) = 0">
          <xsl:call-template name="GWMSelectedLayer"/>
        </xsl:if>
      </xsl:copy>
    </xsl:when>
    <xsl:when test="@id='gwmstyles'">

<!--
  Help on customizing GeoMedia WebMap SVG output:
  Include a custom <defs> tag in the WebMap SVG output
  by calling the Template Name (defined in Custom.xsl) 
  which contains your definitions, for example:
  
    <xsl:call-template name="CustomDefs"/>

  (the above line should be copied outside of the comment markers)

  NOTE: The defs tags must be inserted into the output SVG
  at this location ONLY. Inserting them anywhere else in the
  output may cause problems with the scripting API.
-->

      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
<!--
  Help on customizing GeoMedia WebMap SVG output:
  Include custom styles in the WebMap SVG output
  by calling the Template Name (defined in Custom.xsl) 
  which contains your styles, for example:

    <xsl:call-template name="CustomStyles"/>

  (the above line should be copied outside of the comment markers)

  NOTE: The styles must be inserted into the output SVG
  at this location ONLY. Inserting them anywhere else in the
  output may cause problems with the scripting API.
-->
      </xsl:copy>
    </xsl:when>
    <xsl:otherwise>
    	<xsl:copy>
    		<xsl:apply-templates select="@*|node()"/>
    	</xsl:copy>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template match="svg:svg">
	<xsl:copy>
		<xsl:apply-templates select="@*"/>
		<xsl:attribute name="onload">_gwmOnSVGLoad();</xsl:attribute>
		<xsl:attribute name="onmouseover">_gwmMouseOver(evt);</xsl:attribute>
		<xsl:attribute name="onmouseout">_gwmMouseOut(evt);</xsl:attribute>
    <xsl:attribute name="onclick">_gwmMouseClick(evt);</xsl:attribute>
    <xsl:attribute name="onmousemove">_gwmMouseMove(evt);</xsl:attribute>
    <xsl:attribute name="onmousedown">_gwmMouseDown(evt);</xsl:attribute>
    <xsl:call-template name="Functions"/>
		<xsl:apply-templates select="node()"/>
		<xsl:call-template name="Redlines"/>
		<xsl:call-template name="DynamicGraphics"/>
		<xsl:call-template name="AlwaysOnTop"/>
	</xsl:copy>
</xsl:template>


</xsl:stylesheet>
