Hola a todos, no sabia donde poner este post asique como tiene algo que ver con las bases de datos web lo he colocado aquí.
Estoy estudiando ASIR y estamos con XSL y tengo la siguiente duda:
Me sale todo bien menos el filtrar que si el numero de habitaciones es menor a 5 que se ponga de un color y que si no sea de otro.
Aquí dejo el xml y el XSL, alguna sugerencia?? necesito una mano, pronto tengo el examen
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="viviendas_2.xsl"?>
<viviendas>
<vivienda>
<direccion>
<calle>C/ Julio Burell</calle>
<numero>10</numero>
<localidad>Linares</localidad>
<provincia>Jaén</provincia>
</direccion>
<refCatastral>987654321a</refCatastral>
<habitaciones>
<habitacion area="17">dormitorio</habitacion>
<habitacion area="14">dormitorio</habitacion>
<habitacion area="11">dormitorio</habitacion>
<habitacion area="25">salon</habitacion>
<habitacion area="10">baño</habitacion>
<habitacion area="8">baño</habitacion>
<habitacion area="15">cocina</habitacion>
</habitaciones>
<servicios>
<servicio>Plaza de aparcamiento</servicio>
<servicio>Pista de tenis</servicio>
</servicios>
</vivienda>
<vivienda>
<direccion>
<calle>Avda. Constitución</calle>
<numero>12</numero>
<localidad>Sevilla</localidad>
<provincia>Sevilla</provincia>
</direccion>
<refCatastral>123123331f</refCatastral>
<habitaciones>
<habitacion area="10">dormitorio</habitacion>
<habitacion area="20">salon</habitacion>
<habitacion area="8">baño</habitacion>
<habitacion area="10">cocina</habitacion>
</habitaciones>
<servicios>
<servicio>Pista de Padel</servicio>
<servicio>Piscina</servicio>
<servicio>Plaza de aparcamiento</servicio>
</servicios>
</vivienda>
<vivienda>
<direccion>
<calle>Paseo de Linarejos</calle>
<numero>29</numero>
<localidad>Linares</localidad>
<provincia>Jaén</provincia>
</direccion>
<refCatastral>123645431f</refCatastral>
<habitaciones>
<habitacion area="15">dormitorio</habitacion>
<habitacion area="12">dormitorio</habitacion>
<habitacion area="25">salon</habitacion>
<habitacion area="10">baño</habitacion>
<habitacion area="20">cocina</habitacion>
</habitaciones>
<servicios>
<servicio>Pista de Padel</servicio>
<servicio>Plaza de aparcamiento</servicio>
<servicio>Piscina</servicio>
</servicios>
</vivienda>
</viviendas>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform [nofollow]" xmlns:fo="
http://www.w3.org/1999/XSL/Format [nofollow]">
<xsl:template match="viviendas">
<html>
<body>
<table border="1">
<tr>
<th>direccion</th>
<th>numero_habitaciones</th>
<th>tipo_habitaciones</th>
<th>servicios</th>
<xsl:apply-templates select="vivienda"/>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="vivienda">
<xsl:choose>
<xsl:when test="count(habitacion) >: 5">
<tr bgcolor="red">
<td><xsl:apply-templates select="direccion">
<xsl:sort select="provincia" order="descending"/>
<xsl:sort select="localidad" order="descending"/>
<xsl:sort select="calle" order="descending"/>
</xsl:apply-templates></td>
<td><xsl:apply-templates select="habitaciones"/></td>
<td><xsl:apply-templates select="habitaciones/habitacion"/></td>
<td><xsl:apply-templates select="servicios"/></td>
</tr>
</xsl:when>
<xsl:otherwise>
<tr>
<td bgcolor="green">
<xsl:apply-templates select="direccion">
<xsl:sort select="provincia" order="descending"/>
<xsl:sort select="localidad" order="descending"/>
<xsl:sort select="calle" order="descending"/>
</xsl:apply-templates></td>
<td><xsl:apply-templates select="habitaciones"/></td>
<td><xsl:apply-templates select="habitaciones/habitacion"/></td>
<td><xsl:apply-templates select="servicios"/></td>
</tr>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:template>
<xsl:template match="direccion">
<xsl:value-of select="calle"/> <xsl:text>, </xsl:text>
<xsl:value-of select="numero"/> <xsl:text>. </xsl:text>
<xsl:value-of select="localidad"/> <xsl:text>, </xsl:text>
<xsl:value-of select="provincia"/> <xsl:text>, </xsl:text>
</xsl:template>
<xsl:template match="habitaciones">
<xsl:value-of select="count(habitacion)"/>
</xsl:template>
<xsl:template match="habitaciones/habitacion">
<ul>
<li><xsl:value-of select="@area"/></li> <xsl:text> </xsl:text><xsl:value-of select="."/>
</ul>
</xsl:template>
<xsl:template match="servicios/servicio">
<ul>
<li><xsl:value-of select="."/></li>
</ul>
</xsl:template>
</xsl:stylesheet>