﻿<?xml version="1.0" encoding="utf-8" ?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rs='urn:schemas-microsoft-com:rowset' xmlns:z='#RowsetSchema'
version="1.0">
	<xsl:output method="html" indent="yes" omit-xml-declaration="yes"/>
	<xsl:variable name="cultura" select="substring(//culture/ui/@name,1,2)"></xsl:variable>
	<xsl:variable name="url" select="substring-before(substring-after(//querystring/field[@name='Source'],'?'),'-')"></xsl:variable>
	<xsl:variable name="url2" select="substring-before(//querystring/field[@name=''],'-')"></xsl:variable>
	<xsl:variable name="Idioma">
		<xsl:choose>
			<xsl:when test="$url!=$url2 and $url=''">
				<xsl:value-of select="$url2" />
			</xsl:when>
			<xsl:when test="$cultura!=$url and $url!=$url2 and $url!=''">
				<xsl:value-of select="$url" />
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$cultura" />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<xsl:template match="/">
					<table class="logo zz1_logoLinkId_2" width="100%" cellpadding="0" cellspacing="0">
						<tr id="zz1_logoLinkIdn0">
							<td>
							<a class="zz1_logoLinkId_1" style="float:right;">
							<xsl:if test="VentanaNueva='True'">
							<xsl:attribute name="target">_blank</xsl:attribute>
							</xsl:if>
								<xsl:choose>
									<xsl:when test="$Idioma='es'">
										<xsl:attribute name="href">
											/Paginas/Default_<xsl:value-of select="$Idioma" />
											.aspx
										</xsl:attribute>
									</xsl:when>
									<xsl:when test="$Idioma='ca'">
										<xsl:attribute name="href">
											/Paginas/Default_<xsl:value-of select="$Idioma" />
											.aspx
										</xsl:attribute>
									</xsl:when>
									<xsl:when test="$Idioma='eu'">
										<xsl:attribute name="href">
											/Paginas/Default_<xsl:value-of select="$Idioma" />
											.aspx
										</xsl:attribute>
									</xsl:when>
									<xsl:when test="$Idioma='gl'">
										<xsl:attribute name="href">
											/Paginas/Default_ga.aspx
										</xsl:attribute>
									</xsl:when>
									<xsl:otherwise>
										<xsl:attribute name="href">
											/Paginas/Default_es.aspx
										</xsl:attribute>
									</xsl:otherwise>
								</xsl:choose>
							</a>
							</td>
						</tr>
					</table>
	</xsl:template>
</xsl:stylesheet>

