1 <?xml version="1.0" encoding="UTF-8"?>
    2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    3    <xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.01//EN"
    4       doctype-system="http://www.w3.org/TR/html4/strict.dtd" encoding="UTF-8"
    5       omit-xml-declaration="yes" media-type="text/html" />
    6 
    7    <xsl:template match="/">
    8       <html lang="en">
    9          <head>
   10             <title>Aircraft and Student Data</title>
   11             <meta http-equiv="Content-Language" content="en-us" />
   12 
   13             <style type="text/css">
   14                body {
   15                   font-family: Arial, verdana, helvetica, sans-serif;
   16                   font-size: 1.0em;
   17                   background-color: #fff;
   18                   text-align: center;
   19                   color: #000;
   20                }
   21                
   22                table {
   23                   border-collapse: collapse;
   24                   empty-cells: show;
   25                   border-spacing: 0px;
   26                   border: 4px solid #000;
   27                   background-color: #fff;
   28                   margin: 25px;
   29                }
   30                
   31                table td, table th {
   32                   border: 1px solid #000;
   33                   padding: 8px;
   34                }
   35                
   36                table caption {
   37                   caption-side: top;
   38                   font-weight: bold;
   39                   font-size: 1.5em;
   40                   text-align: center;
   41                   margin: 3px;
   42                   padding: 0px;
   43                   text-decoration: underline;
   44                   text-transform: capitalize;
   45                   font-variant: small-caps;
   46                }
   47                
   48                table thead tr {
   49                   border-bottom: 3px double #000;
   50                   background-color: #FFED5B;
   51                   color: #18146F;
   52                }
   53                
   54                table thead th {
   55                   font-weight: bold;
   56                   font-size: 1.2em;
   57                   text-align: center;
   58                   text-transform: capitalize;
   59                   font-variant: small-caps;
   60                }
   61                
   62                table th[scope="row"] {
   63                   font-weight: bold;
   64                   background-color: #9AAAFB;
   65                   font-size: 1.0em;
   66                   text-align: right;
   67                }
   68                
   69                table tr td {
   70                   text-align: left;
   71                }
   72             </style>
   73 
   74          </head>
   75          <body>
   76             <h1>Aircraft and Student Data</h1>
   77             <xsl:for-each select="//table_data">
   78                <table cellspacing="0">
   79                   <caption>
   80                      <xsl:value-of select="@name" />
   81                   </caption>
   82                   <thead>
   83                      <tr>
   84                         <xsl:for-each select="row[1]/field[@name]">
   85                            <xsl:if test="@name!='snum' and @name!='age'">
   86                               <th scope="col">
   87                                  <xsl:value-of select="@name" />
   88                               </th>
   89                            </xsl:if>
   90                         </xsl:for-each>
   91                      </tr>
   92                   </thead>
   93 
   94                   <xsl:for-each select="row">
   95                      <tr>
   96                         <xsl:for-each select="field">
   97                            <xsl:if test="@name!='snum' and @name!='age'">
   98                               <xsl:choose>
   99                                  <xsl:when test="@name='sname'">
  100                                     <th scope="row">
  101                                        <xsl:value-of select="." />
  102                                     </th>
  103                                  </xsl:when>
  104                                  <xsl:otherwise>
  105                                     <td>
  106                                        <xsl:value-of select="." />
  107                                     </td>
  108                                  </xsl:otherwise>
  109                               </xsl:choose>
  110                            </xsl:if>
  111                         </xsl:for-each>
  112                      </tr>
  113                   </xsl:for-each>
  114 
  115                </table>
  116             </xsl:for-each>
  117          </body>
  118       </html>
  119    </xsl:template>
  120 </xsl:stylesheet>
  121