/ sc03.xsl
sc03.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 <xsl:output method="html" encoding="UTF-8"/> 4 5 <xsl:template match="/"> 6 <html> 7 <head> 8 <style> 9 table {width: 100%; border-collapse: collapse;} 10 th, td {padding: 8px; text-align: left; border-bottom: 1px solid #ddd;} 11 tr:hover {background-color: #f5f5f5;} 12 th {background-color: #4CAF50; color: white;} 13 </style> 14 </head> 15 <body> 16 <h2>Commandes de <xsl:value-of select="recipeBox/customers/customer[@id='c101']/name"/></h2> 17 <table border="1"> 18 <tr bgcolor="#9acd32"> 19 <th>Menu</th> 20 <th>Date</th> 21 <th>Address</th> 22 <th>Status</th> 23 24 </tr> 25 <xsl:for-each select="recipeBox/orders/order[@customerId='c101']"> 26 <tr> 27 <td> 28 <xsl:variable name="menuId" select="menuId"/> 29 <xsl:value-of select="/recipeBox/menus/menu[@id=$menuId]/@name"/> 30 </td> 31 <td> 32 <xsl:value-of select="@date"/> 33 </td> 34 <td> 35 <xsl:value-of select="deliveryAddress"/> 36 </td> 37 <td> 38 <xsl:value-of select="status"/> 39 </td> 40 41 </tr> 42 </xsl:for-each> 43 </table> 44 </body> 45 </html> 46 </xsl:template> 47 48 </xsl:stylesheet>