Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:template match="/">
- <html>
- <head>
- <style>
- th {
- background-color:orange;
- color:white;
- }
- </style>
- </head>
- <body>
- <h1>Mi biblioteca personal</h1>
- <br></br>
- <table border="1">
- <tr>
- <th>Titulo</th>
- <th>Autor</th>
- <th>Precio</th>
- <th>Isbn</th>
- <th>Portada</th>
- </tr>
- <xsl:for-each select="libreria/libro">
- <xsl:sort select="precio"/>
- <xsl:choose>
- <xsl:when test="precio < 12.5">
- <tr>
- <td style="background-color:red"><xsl:value-of select="titulo"/></td>
- <td style="background:red"><xsl:value-of select="autor"/></td>
- <td style="background:red"><xsl:value-of select="precio"/></td>
- <td style="background:red"><xsl:value-of select="isbn"/></td>
- <td style="background:red"><img src="{portada}" width="150" height="150"></img></td>
- </tr>
- </xsl:when>
- <xsl:when test="precio > 25.50">
- <tr>
- <td style="background:green"><xsl:value-of select="titulo"/></td>
- <td style="background:green"><xsl:value-of select="autor"/></td>
- <td style="background:green"><xsl:value-of select="precio"/></td>
- <td style="background:green"><xsl:value-of select="isbn"/></td>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- <tr>
- <td style="background:blue"><xsl:value-of select="titulo"/></td>
- <td style="background:blue"><xsl:value-of select="autor"/></td>
- <td style="background:blue"><xsl:value-of select="precio"/></td>
- <td style="background:blue"><xsl:value-of select="isbn"/></td>
- </tr>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </table>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement