Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.46 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4.  
  5.   <xsl:template match="/">
  6.     <html>
  7.       <head>
  8.         <style>
  9.           table,td {border: 1px solid black}
  10.           .rojo {background:#d64161}
  11.           .amarillo {background:#feb236}
  12.           .azul {background:#6b5b95}
  13.         </style>
  14.  
  15.       </head>
  16.       <body>
  17.         <h1>Alumnos</h1>
  18.  
  19.         <table>
  20.           <tr>
  21.             <th>Nombre</th>
  22.             <th>Apellidos</th>
  23.             <th>Curso</th>
  24.             <th>Expediente</th>
  25.           </tr>
  26.  
  27.           <xsl:for-each select="alumnos/alumno">
  28.             <xsl:sort select="curso" order="ascending"/>
  29.             <xsl:choose>
  30.               <xsl:when test="curso='ASIX'">
  31.                 <tr class="rojo">
  32.                   <td>
  33.                     <xsl:value-of select="nombre"/>
  34.                   </td>
  35.                   <td>
  36.                     <xsl:value-of select="apellidos"/>
  37.                   </td>
  38.                   <td>
  39.                     <xsl:value-of select="curso"/>
  40.                   </td>
  41.                   <td>
  42.                     <xsl:value-of select="expediente"/>
  43.                   </td>
  44.                 </tr>
  45.               </xsl:when>
  46.  
  47.               <xsl:when test="curso='DAM'">
  48.                 <tr class="amarillo">
  49.                   <td>
  50.                     <xsl:value-of select="nombre"/>
  51.                   </td>
  52.                   <td>
  53.                     <xsl:value-of select="apellidos"/>
  54.                   </td>
  55.                   <td>
  56.                     <xsl:value-of select="curso"/>
  57.                   </td>
  58.                   <td>
  59.                     <xsl:value-of select="expediente"/>
  60.                   </td>
  61.                 </tr>
  62.               </xsl:when>
  63.  
  64.               <xsl:when test="curso='DAW'">
  65.                 <tr class="azul">
  66.                   <td>
  67.                     <xsl:value-of select="nombre"/>
  68.                   </td>
  69.                   <td>
  70.                     <xsl:value-of select="apellidos"/>
  71.                   </td>
  72.                   <td>
  73.                     <xsl:value-of select="curso"/>
  74.                   </td>
  75.                   <td>
  76.                     <xsl:value-of select="expediente"/>
  77.                   </td>
  78.                 </tr>
  79.               </xsl:when>
  80.             </xsl:choose>
  81.           </xsl:for-each>
  82.         </table>
  83.       </body>
  84.     </html>
  85.   </xsl:template>
  86. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement