<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml">
   <head>
      <title>Display your data using XSLT</title>
      <link href="./w3ctalk-640w.css" rel="stylesheet" type="text/css" title="640w" />
      <link href="./w3ctalk-640.css" rel="alternate stylesheet" type="text/css" title="640" />
      <link href="./w3ctalk-800w.css" rel="alternate stylesheet" type="text/css" title="800w" />
      <link href="./w3ctalk-800.css" rel="alternate stylesheet" type="text/css" title="800" />
      <link href="./w3ctalk-1024w.css" rel="alternate stylesheet" type="text/css" title="1024w" />
      <link href="./w3ctalk-1024.css" rel="alternate stylesheet" type="text/css" title="1024" />
      <link rel="next" href="slide6.xml" title="Next" />
      <link rel="previous" href="slide4.xml" title="Previous" />
      <link rel="contents" href="Overview.xml" title="Contents" />
      <link rel="up" href="Overview.xml" title="Up" />
   </head>
   <body><a href="http://www.w3.org/"><img src="./w3c_home.gif" alt="W3C  " /></a><h1 class="slide">
         <h2>Display your data using XSLT</h2>
      </h1>
      <hr class="top" />
      <div>
         <p>Uses:</p>
         <ul>
            	
            <li>Transform custom XML into "displayable" XML</li>
            	
            <li>More generally, transform anyXML into anyOtherXML</li>
            
         </ul>
         <p>XSLT works by defining templates. In our example,</p>
         <ul>
            	
            <li><code>&lt;title&gt;</code> becomes <code>&lt;h3&gt;</code></li>
            	
            <li>Template:<pre>&lt;xsl:template match="title"&gt;
  &lt;h3&gt;&lt;xsl:apply-templates/&gt;&lt;/h3&gt;
&lt;/xsl:templates&gt;</pre>
               	</li>
            
         </ul>
         <p>Full recordML to HTML transform:</p><pre>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; 
&lt;xsl:template match="/"&gt;
  &lt;html&gt;&lt;xsl:apply-templates/&gt;&lt;/html&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match="inventory"&gt;
  &lt;head&gt;&lt;xsl:copy-of select="title"/&gt;&lt;/head&gt;
  &lt;body&gt;&lt;table&gt;&lt;xsl:apply-templates/&gt;&lt;/table&gt;&lt;/body&gt;
&lt;/xsl:templates&gt;

&lt;xsl:templates match="record"&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;xsl:apply-templates select="artist"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;xsl:apply-templates select="title"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;xsl:apply-templates select="price"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;xsl:apply-templates select="@in-store"/&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/xsl:templates&gt;

&lt;xsl:template match="price"&gt;
  &lt;xsl:value-of select="concat(.,' ',@unit)"/&gt;
&lt;/xsl:template&gt;
</pre></div>
      <hr class="bottom" />
      <table class="navbar" cellspacing="0" cellpadding="0" width="97%" summary="footer">
         <tr valign="bottom">
            <td>
               <p class="index">5 of 23</p>
            </td>
            <td valign="top">
               <div><a rel="previous" href="slide4.xml" accesskey="P"><img src="./left.gif" width="32" height="32" alt=" previous" title="Back to &#34;From one to the other&#34;" /></a><a rel="contents" href="Overview.xml" accesskey="C"><img src="./toc.png" width="32" height="32" alt=" contents" title="Table of Contents" /></a><a rel="next" href="slide6.xml" accesskey="N"><img src="./right.gif" width="32" height="32" alt=" next" title="On to &#34;Many output formats&#34;" /></a></div>
            </td>
         </tr>
      </table>
   </body>
</html>