Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  3. <xsl:template match="/">
  4. <html>
  5. <head>
  6. <style>
  7. th {
  8. background-color:orange;
  9. color:white;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <h1>Mi biblioteca personal</h1>
  15. <br></br>
  16. <table border="1">
  17. <tr>
  18. <th>Titulo</th>
  19. <th>Autor</th>
  20. <th>Precio</th>
  21. <th>Isbn</th>
  22. <th>Portada</th>
  23. </tr>
  24. <xsl:for-each select="libreria/libro">
  25. <xsl:sort select="precio"/>
  26. <xsl:choose>
  27. <xsl:when test="precio &lt; 12.5">
  28. <tr>
  29. <td style="background-color:red"><xsl:value-of select="titulo"/></td>
  30. <td style="background:red"><xsl:value-of select="autor"/></td>
  31. <td style="background:red"><xsl:value-of select="precio"/></td>
  32. <td style="background:red"><xsl:value-of select="isbn"/></td>
  33. <td style="background:red"><img src="{portada}" width="150" height="150"></img></td>
  34. </tr>
  35. </xsl:when>
  36.  
  37. <xsl:when test="precio &gt; 25.50">
  38. <tr>
  39. <td style="background:green"><xsl:value-of select="titulo"/></td>
  40. <td style="background:green"><xsl:value-of select="autor"/></td>
  41. <td style="background:green"><xsl:value-of select="precio"/></td>
  42. <td style="background:green"><xsl:value-of select="isbn"/></td>
  43. </tr>
  44. </xsl:when>
  45. <xsl:otherwise>
  46. <tr>
  47. <td style="background:blue"><xsl:value-of select="titulo"/></td>
  48. <td style="background:blue"><xsl:value-of select="autor"/></td>
  49. <td style="background:blue"><xsl:value-of select="precio"/></td>
  50. <td style="background:blue"><xsl:value-of select="isbn"/></td>
  51. </tr>
  52. </xsl:otherwise>
  53.  
  54. </xsl:choose>
  55. </xsl:for-each>
  56. </table>
  57. </body>
  58. </html>
  59. </xsl:template>
  60. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement