Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <html>
- <head>
- <style>
- table,td {border: 1px solid black}
- .rojo {background:#d64161}
- .amarillo {background:#feb236}
- .azul {background:#6b5b95}
- </style>
- </head>
- <body>
- <h1>Alumnos</h1>
- <table>
- <tr>
- <th>Nombre</th>
- <th>Apellidos</th>
- <th>Curso</th>
- <th>Expediente</th>
- </tr>
- <xsl:for-each select="alumnos/alumno">
- <xsl:sort select="curso" order="ascending"/>
- <xsl:choose>
- <xsl:when test="curso='ASIX'">
- <tr class="rojo">
- <td>
- <xsl:value-of select="nombre"/>
- </td>
- <td>
- <xsl:value-of select="apellidos"/>
- </td>
- <td>
- <xsl:value-of select="curso"/>
- </td>
- <td>
- <xsl:value-of select="expediente"/>
- </td>
- </tr>
- </xsl:when>
- <xsl:when test="curso='DAM'">
- <tr class="amarillo">
- <td>
- <xsl:value-of select="nombre"/>
- </td>
- <td>
- <xsl:value-of select="apellidos"/>
- </td>
- <td>
- <xsl:value-of select="curso"/>
- </td>
- <td>
- <xsl:value-of select="expediente"/>
- </td>
- </tr>
- </xsl:when>
- <xsl:when test="curso='DAW'">
- <tr class="azul">
- <td>
- <xsl:value-of select="nombre"/>
- </td>
- <td>
- <xsl:value-of select="apellidos"/>
- </td>
- <td>
- <xsl:value-of select="curso"/>
- </td>
- <td>
- <xsl:value-of select="expediente"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </table>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement