/ sc02.xsl
sc02.xsl
 1  <?xml version="1.0" encoding="UTF-8"?>
 2  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 3  
 4      <xsl:output method="html" doctype-public="XSLT-compat" encoding="UTF-8" indent="yes"/>
 5  
 6      <xsl:template match="/">
 7          <html>
 8              <head>
 9                  <title>Menus Disponibles</title>
10                  <style>
11                      body { font-family: Arial, sans-serif; }
12                      table { width: 100%; margin-bottom: 20px; border-collapse: collapse; }
13                      th, td { padding: 8px; text-align: left; border: 1px solid #ddd; }
14                      th { background-color: #f2f2f2; }
15                      td.day { font-weight: bold; }
16                      .Monday { background-color: #FFD700; }
17                      .Tuesday { background-color: #ADFF2F; }
18                      .Wednesday { background-color: #87CEEB; }
19                      .Thursday { background-color: #FFB6C1; }
20                      .Friday { background-color: #20B2AA; }
21                      .Saturday { background-color: #BA55D3; }
22                      .Sunday { background-color: #FF6347; }
23                  </style>
24              </head>
25              <body>
26                  <h2>Menus Disponibles</h2>
27                  <xsl:for-each select="recipeBox/menus/menu">
28                      <h3>Menu: <xsl:value-of select="@name"/></h3>
29                      <table>
30                          <tr>
31                              <th>Jour</th>
32                              <th>Recettes</th>
33                          </tr>
34                          <xsl:for-each select="meal">
35                              <xsl:sort select="substring-before('MondayTuesdayWednesdayThursdayFridaySaturdaySunday', @day)" data-type="number"/>
36                              <tr>
37                                  <td class="day {@day}"><xsl:value-of select="@day"/></td>
38                                  <td>
39                                      <xsl:for-each select="/recipeBox/recipes/recipe[@id=current()/@recipeId]">
40                                          <xsl:value-of select="title"/>
41                                      </xsl:for-each>
42                                  </td>
43                              </tr>
44                          </xsl:for-each>
45                      </table>
46                  </xsl:for-each>
47              </body>
48          </html>
49      </xsl:template>
50  
51  </xsl:stylesheet>