Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/09/2011, 12:33
kiko's
 
Fecha de Ingreso: julio-2005
Mensajes: 310
Antigüedad: 18 años, 9 meses
Puntos: 36
Variables en XSL

Hola amigos,

Tengo un contenedor con una imagen de fondo que necesito cambiar según la situación. Hago lo siguiente:

Código HTML:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="/">

<xsl:choose>
     <xsl:when test="$actualTime &gt; $sunrise and $actualTime &lt; $sunset">
         <xsl:variable name="weather" select="'1.png'">
     </xsl:when>
     <xsl:otherwise>
         <xsl:variable name="weather" select="'2.png'">
     </xsl:otherwise>
</xsl:choose>

<div class="WeatherSprite" style="background-image: url(images/weather_icons/{[B]$weather[/B]}"></div> 
Pero me dice que la variable no ha sido definida. ¿Es qué se declara como local sólo dentro del "choose"?

Saludos.