リスト10 template.xsl

 1 <?xml version='1.0' encoding="euc-jp"?>
 2 <xsl:stylesheet version="1.0"
 3                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 4   <xsl:output indent="yes" method="xml" encoding="euc-jp"/>
 5   <xsl:template match="/">
 6     <html>
 7       <head>
 8         <meta http-equiv="Content-Type"
 9               content="text/html; charset=euc-jp"/>
10         <title>goods list</title>
11         <style type="text/css">
12           body {
13             background: #eeeeee;
14             margin-top: 50px;
15             margin-left: 50px;
16           }
17           table {
18             width: 500px;
19             border-width: 1px;
20             border-style: solid;
21             border-color: #444444;
22             background-color: #dddddd;
23           }
24           td {
25             border-width: 1px;
26             border-style: solid;
27             border-color: #aaaaaa;
28             background-color: #ffffff
29           }
30           img {
31             width: 80%;
32           }
33         </style>
34       </head>
35       <body>
36         <p>商品リスト</p>
37         <table>
38           <tr>
39             <th>番号</th>
40             <th>種類</th>
41             <th>サンプル</th>
42             <th>名前</th>
43             <th>入荷日</th>
44             <th>詳細</th>
45             <th>値段</th>
46           </tr>
47           <xsl:for-each select="goodsList/goods">
48             <tr>
49               <td style="text-align: right"><xsl:value-of select="@id"/></td>
50               <td><xsl:value-of select="category/name"/></td>
51               <td><img src="{@sample}"/></td>
52               <td><xsl:value-of select="name"/></td>
53               <td><xsl:value-of select="xmlDate"/></td>
54               <td><xsl:value-of select="description"/></td>
55               <td style="text-align: right">
56                 <xsl:value-of select="price/retail"/>
57               </td>
58             </tr>
59           </xsl:for-each>
60         </table>
61       </body>
62     </html>
63   </xsl:template>
64 </xsl:stylesheet>