El XML:
Código:
Ahora la hoja de estilo a la que le llamo choose.xsl<?xml version="1.0" encoding="utf-8"?> <?xml:stylesheet type="text/xsl" href="choose.xsl"?> <productdata> <product proid="p001" category="toy"> <productname>Mini Bus</productname> <description>This is a toy for children aged 4 and above</description> <price>75</price> <quantity>100</quantity> </product> <product proid="p002" category="book"> <productname>The English Patient</productname> <description>This is a book set during the second world war</description> <price>19</price> <quantity>75</quantity> </product> <product proid="p003" category="toy"> <productname>Race Car</productname> <description>This is a toy for children aged 12 and above</description> <price>60</price> <quantity>54</quantity> </product> </productdata>
Código:
El problema viene aquí, cuando quiero ver el resultado de esto, Firefox me tira un error y Chrome muestra todo en una sola línea y desordenado.El único navegador que responde el Internet Explorer 8.<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="faltaenlace" version="1.0"> <xsl:output method="html"/> <xsl:template match="/"> <html xmlns="faltaenlace"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Untitled Document</title> </head> <body> <xsl:for-each select="//product"> <xsl:choose> <xsl:when test="price[.>50]"> <font color="red"> Nombre del producto <xsl:value-of select="productname"/> <br /> Descripción <xsl:value-of select="description"/><br /> Precio <xsl:value-of select="price"/><br /> Cantidad <xsl:value-of select="quantity"/><br /> <hr /> </font> </xsl:when> <xsl:otherwise> <font color="green"> Nombre del producto <xsl:value-of select="productname"/> <br /> Descripción <xsl:value-of select="description"/><br /> Precio <xsl:value-of select="price"/><br /> Cantidad <xsl:value-of select="quantity"/> <hr /> </font> </xsl:otherwise> </xsl:choose> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet>
Alguien me podría dar alguna pista para solucionar mi problema?
Gracias por adelantado
Muy importante:Como soy nuevo no puedo adjuntar enlaces por eso que en el xsl faltan los dos enlaces que deben ir:
<xsl:stylesheet xmlns:xsl="aquí falta el enlace">
<html xmlns="y aquí también">
Estaba pensando en ponerlos pero voy a confundir así que ustedes porfavor los completan.