http://www.w3.org/TR/html4/strict.dtd"> WebHowTo.xsl.html
<?xml version="1.0" ?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> 
 <!ENTITY bullet "&#8226;"> <!ENTITY copy "&#169;">
 <!ENTITY at "&#064;"> ]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:date="http://exslt.org/dates-and-times"
 version="1.0">
<xsl:output method="html"/>

<!-- Get some parameters from other files -->
<xsl:param name="vars"/>
<xsl:param name="this_file"/>
<xsl:variable name="fptr" select="document($vars)"/>
<xsl:variable name="this_css" select="$fptr//this_css"/>
<xsl:variable name="this_favicon" select="$fptr//this_favicon"/>
<xsl:variable name="this_author_name" select="$fptr//this_author_name"/>
<xsl:variable name="this_copyright" select="$fptr//this_copyright"/>
<xsl:variable name="this_copyright_link" select="$fptr//this_copyright_link"/>
<xsl:variable name="this_author_email" select="$fptr//this_author_email"/>
<xsl:variable name="this_author_contact" select="$fptr//this_author_contact"/>
<xsl:variable name="this_generator" select="$fptr//this_generator"/>

<xsl:template match="WebHowTo">
 <html>
 <xsl:comment> Doc Header </xsl:comment>
 <head>
  <title><xsl:value-of select="title"/></title>
  <link rel="stylesheet" >
    <xsl:attribute name="href">
     <xsl:value-of select="$this_css"/>
    </xsl:attribute>
  </link>
  <link rel="icon" type="image/png" >
    <xsl:attribute name="href">
     <xsl:value-of select="$this_favicon"/>
    </xsl:attribute>
  </link>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta name="author" content="Denice Deatrich" />
 </head>
 <body>
 <h1><xsl:value-of select="title"/></h1>
 <div class="section">
 <h1>Table of Contents</h1>
 <ul>
 <xsl:for-each select="section">
   <xsl:variable name="secpos">
    <xsl:number value="position()"/>
   </xsl:variable>
   <li class="none">
    <xsl:value-of select="$secpos"/>
    <xsl:text>&nbsp;&nbsp;</xsl:text>
    <a>
     <xsl:attribute name="href">
     <xsl:value-of select="$this_file"/>
     <xsl:text>#</xsl:text>
     <xsl:value-of select="@id"/>
     </xsl:attribute>
     <xsl:value-of select="title"/>
    </a>
   </li>
   <ul>
    <xsl:for-each select="sect2">
    <xsl:variable name="sec2pos">
     <xsl:number value="position()"/>
    </xsl:variable>
    <li class="none">&nbsp;
     <xsl:value-of select="$secpos"/>.<xsl:value-of select="position()"/>
     <xsl:text> </xsl:text>
     <a>
     <xsl:attribute name="href">
     <xsl:value-of select="$this_file"/>
     <xsl:text>#</xsl:text>
     <xsl:value-of select="@id"/>
     </xsl:attribute>
     <xsl:value-of select="title"/>
     </a>
    </li>
    <ul>
    <xsl:for-each select="sect3">
     <xsl:variable name="sec3pos">
      <xsl:number value="position()"/>
     </xsl:variable>
     <li class="none">&nbsp;
      <xsl:value-of select="$secpos"/>.<xsl:value-of select="$sec2pos"/>
      <xsl:text>.</xsl:text><xsl:value-of select="position()"/>
      <xsl:text> </xsl:text>
      <a>
       <xsl:attribute name="href">
       <xsl:value-of select="$this_file"/>
       <xsl:text>#</xsl:text>
       <xsl:value-of select="@id"/>
       </xsl:attribute>
       <xsl:value-of select="title"/>
      </a>
     </li>

     <ul>
      <xsl:for-each select="sect4">
       <li class="none">&nbsp;
        <xsl:value-of select="$secpos"/>.<xsl:value-of select="$sec2pos"/>
        <xsl:text>.</xsl:text><xsl:value-of select="$sec3pos"/>
        <xsl:text>.</xsl:text><xsl:value-of select="position()"/>
        <xsl:text> </xsl:text>
        <a>
         <xsl:attribute name="href">
         <xsl:value-of select="$this_file"/>
         <xsl:text>#</xsl:text>
         <xsl:value-of select="@id"/>
         </xsl:attribute>
         <xsl:value-of select="title"/>
        </a>
       </li>
      </xsl:for-each>
     </ul>

    </xsl:for-each>
    </ul>
   </xsl:for-each>
   </ul>
 </xsl:for-each>
 </ul>
 <xsl:if test="count(appendices)>0">
 <h2>Appendices</h2>
 <ul>
   <xsl:for-each select="appendices/appendix">
   <li class="none">&nbsp;
     <xsl:number value="position()" format="A"/>
     <xsl:text>. </xsl:text>
     <a>
       <xsl:attribute name="href">
         <xsl:value-of select="$this_file"/>
         <xsl:text>#</xsl:text>
         <xsl:value-of select="@id"/>
       </xsl:attribute>
       <xsl:value-of select="title"/>
     </a>
   </li>
   </xsl:for-each>
 </ul>
 </xsl:if>

 </div>
 <hr/>
 <xsl:apply-templates/>
 <hr/>
 <p>Document generation:
  <a>
    <xsl:attribute name="href">
     <xsl:value-of select="$this_generator"/>
    </xsl:attribute>
    <xsl:value-of select="$this_generator"/>
  </a>
 </p>
 <p>Number of sections provided:
   <xsl:value-of select="count(//section)" />
 </p>
 </body>
 </html>
</xsl:template>

<!-- XML functions -->
<xsl:template name="namelink">
 <xsl:if test="@id">
 <a>
   <xsl:attribute name="name">
     <xsl:value-of select="@id"/>
   </xsl:attribute>
   <xsl:value-of select="title"/>
 </a>
 </xsl:if>
</xsl:template>

<!-- eat these -->
<xsl:template match="title">
</xsl:template>
<xsl:template match="list">
</xsl:template>
<xsl:template match="favicon">
</xsl:template>

<xsl:template match="section">
 <div class="section">
 <xsl:variable name="secpos">
 <xsl:number count="section" />
 </xsl:variable>
 <h1><xsl:value-of select="$secpos"/>.
 <xsl:call-template name="namelink"/>
 </h1>
 <xsl:apply-templates/>
 </div>
</xsl:template>

<xsl:template match="prolog">
 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="sect2">
 <h2>
  <xsl:number value="count(preceding::section)+1" />
  <xsl:text>.</xsl:text>
  <xsl:number count="sect2" />
  <xsl:text>&nbsp;&nbsp;</xsl:text>
  <xsl:call-template name="namelink"/>
 </h2>
 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="sect3">
 <h3>
  <xsl:number value="count(preceding::section)+1" />
  <xsl:text>.</xsl:text>
  <xsl:number count="sect2" />
  <xsl:text>.</xsl:text>
  <xsl:number count="sect3" />
  <xsl:text>&nbsp;&nbsp;</xsl:text>
  <xsl:value-of select="title" />
 </h3>
 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="sect4">
 <h4>
  <xsl:number value="count(preceding::section)+1" />
  <xsl:text>.</xsl:text>
  <xsl:number count="sect2" />
  <xsl:text>.</xsl:text>
  <xsl:number count="sect3" />
  <xsl:text>.</xsl:text>
  <xsl:number count="sect4" />
  <xsl:text>&nbsp;&nbsp;</xsl:text>
  <xsl:value-of select="title" />
 </h4>
 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="details">
 <pre><xsl:apply-templates/></pre>
</xsl:template>

<xsl:template match="block">
 <p>
 <xsl:apply-templates/>
 </p>
</xsl:template>

<xsl:template match="list[@type='numbered']">
 <ol>
  <xsl:apply-templates/>
 </ol>
</xsl:template>

<xsl:template match="list[@type='lettered']">
 <ol class="lettered">
  <xsl:apply-templates/>
 </ol>
</xsl:template>

<xsl:template match="list[@type='roman']">
 <ol>
  <xsl:apply-templates/>
 </ol>
</xsl:template>

<xsl:template match="list[@type='bullet']">
 <ul><xsl:apply-templates/></ul>
</xsl:template>

<!--
<xsl:template match="list[@type='desc']">
 <dl><xsl:apply-templates/></dl>
</xsl:template>

<xsl:template match="item[@desc]">
  <dt>&bullet;&nbsp;<xsl:value-of select="text()"/></dt>
  <dd><xsl:value-of select="@desc"/>
  </dd>
  <xsl:apply-templates/>
</xsl:template>
-->
<xsl:template match="deflist">
  <dl><xsl:apply-templates/></dl>
</xsl:template>

<xsl:template match="term">
  <dt>&bullet;&nbsp;<xsl:value-of select="."/></dt>
</xsl:template>

<xsl:template match="def">
  <dd><xsl:value-of select="text()"/>
  <xsl:apply-templates/>
  </dd>
</xsl:template>

<xsl:template match="item">
  <li>
   <xsl:apply-templates/>
  </li>
</xsl:template>


<!--
<xsl:template match="i/title">
 <h5>
  <xsl:apply-templates/>
 </h5>
</xsl:template>
-->

<xsl:template match="f[@eg]">
 <em class="file">
 <a>
   <xsl:attribute name="href">
   <xsl:value-of select="@eg"/>
   </xsl:attribute>
   <xsl:attribute name="target">
   <xsl:text>output</xsl:text>
   </xsl:attribute>
   <xsl:value-of select="."/>
 </a>
 </em>
</xsl:template>

<xsl:template match="f">
 <em class="file"><xsl:apply-templates/></em>
</xsl:template>

<xsl:template match="rpm">
 <span class="rpm"><xsl:apply-templates/></span>
</xsl:template>

<xsl:template match="note">
 <span class="note"><xsl:apply-templates/></span>
</xsl:template>

<xsl:template match="i">
 <em><xsl:apply-templates/></em>
</xsl:template>

<xsl:template match="b">
 <b><xsl:apply-templates/></b>
</xsl:template>

<xsl:template match="u">
 <u><xsl:apply-templates/></u>
</xsl:template>

<xsl:template match="c">
 <span class="command"><xsl:apply-templates/></span>
</xsl:template>

<xsl:template match="prompt[@type='root']">
 <br/>
 <samp><em>ROOT# </em><span class="bbold"><xsl:apply-templates/></span></samp>
</xsl:template>

<xsl:template match="prompt">
 <br/><samp><em>$ </em><xsl:apply-templates/></samp>
</xsl:template>

<xsl:template match="output">
 <br/><pre class="output"><xsl:apply-templates/></pre>
</xsl:template>

<xsl:template match="comment">
 <xsl:comment>
  <xsl:value-of select="."/>
 </xsl:comment>
</xsl:template>

<xsl:template match="code">
  <code><xsl:value-of select="."/></code>
</xsl:template>

<xsl:template match="tag">
  <span class="tag">&lt;<xsl:value-of select="."/>/&gt;</span>
</xsl:template>

<xsl:template match="attr">
  <span class="attr">&quot;<xsl:value-of select="."/>&quot;</span>
</xsl:template>

<xsl:template match="space">
  <br/>
</xsl:template>

<xsl:template match="table">
 <table><xsl:apply-templates/></table>
</xsl:template>

<xsl:template match="row[@type='header']">
 <tr>
 <th><xsl:value-of select="@prop"/></th>
 <th><xsl:value-of select="@val"/></th>
 </tr>
 <tr><th colspan="2"><hr/></th></tr>
</xsl:template>

<xsl:template match="url">
 <a>
  <xsl:attribute name="href">
    <xsl:value-of select="."/>
  </xsl:attribute>
  <xsl:choose>
    <xsl:when test="@val">
     <xsl:value-of select="@val"/>
    </xsl:when>
    <xsl:otherwise>
     <xsl:value-of select="."/>
    </xsl:otherwise>
  </xsl:choose>
 </a>
</xsl:template>

<xsl:template match="row">
 <tr>
 <xsl:if test="@ref">
  <td>
  <a>
    <xsl:attribute name="href">
      <xsl:value-of select="@ref"/>
    </xsl:attribute>
    <xsl:value-of select="@prop"/>
  </a>
  </td>
 </xsl:if>
 <xsl:if test="not(@ref)">
  <td><xsl:value-of select="@prop"/></td>
 </xsl:if>
 <td><xsl:value-of select="@val"/></td>
 </tr>
</xsl:template>

<xsl:template match="appendices">
 <div class="section">
  <xsl:apply-templates/>
 </div>
</xsl:template>

<xsl:template match="appendix">

 <xsl:if test="@type='note'">
  <xsl:variable name="apppos">
   <xsl:number count="appendix" format="A" />
  </xsl:variable>
  <h2>Appendix
  <xsl:value-of select="$apppos"/> : <xsl:call-template name="namelink"/>
  </h2>
  <xsl:apply-templates/>
  <ul>
  <xsl:for-each select="//note">
    <xsl:sort select="."/>
    <xsl:if test="not(@note='exclude')">
      <xsl:variable name="thisnote" select="."/>
      <xsl:if test="not(preceding::note=$thisnote)">
        <li class="square"><xsl:value-of select="$thisnote"/></li>
      </xsl:if>
    </xsl:if>
  </xsl:for-each>
  </ul>
  </xsl:if>

 <xsl:if test="@type='commands'">
  <xsl:variable name="apppos">
   <xsl:number count="appendix" format="A" />
  </xsl:variable>
  <h2>Appendix
  <xsl:value-of select="$apppos"/> : <xsl:call-template name="namelink"/>
  </h2>
  <xsl:apply-templates/>
  <ul>
  <xsl:for-each select="//prompt">
    <xsl:sort select="."/>
    <xsl:if test="not(@note='exclude')">
      <xsl:variable name="thisprompt" select="."/>
      <xsl:if test="not(preceding::prompt=$thisprompt)">
        <li class="square"><xsl:value-of select="$thisprompt"/></li>
      </xsl:if>
    </xsl:if>
  </xsl:for-each>
  </ul>
 </xsl:if>

 <xsl:if test="@type='tags'">
  <xsl:variable name="apppos">
   <xsl:number count="appendix" format="A" />
  </xsl:variable>
  <h2>Appendix
  <xsl:value-of select="$apppos"/> : <xsl:call-template name="namelink"/>
  </h2>
  <xsl:apply-templates/>
  <ul>
  <xsl:for-each select="//tag">
     <xsl:sort select="."/>
     <xsl:variable name="thistag" select="."/>
     <xsl:if test="not(preceding::tag=$thistag)">
       <li class="square"><xsl:value-of select="$thistag"/></li>
     </xsl:if>
  </xsl:for-each>
  </ul>
 </xsl:if>
<!--
I removed this from the doc.. it is interesting as an example of how
to pick out a list of files that have hypertext links (and would mean that
in principle you _could_ generate a table of these files), but in the end the
document maintainer would still like to have a complete list of example,
clickable files that have extended descriptions.  In playing with this I
found that it would be annoying to provide enough info in the document to
build a reference table of examples.  Moreover it makes it difficult to
include examples that are NOT referenced in the text.
  <xsl:if test="@type='files'">
    <xsl:for-each select="//attribute::eg">
      <xsl:sort select="."/>
      <xsl:variable name="thisfile" select="."/>
      <xsl:if test="not(preceding::f=$thisfile)">
        <xsl:value-of select="$thisfile"/><br/>
      </xsl:if>
    </xsl:for-each>
  </xsl:if>
-->
 <xsl:if test="@type='rpm'">
  <xsl:variable name="apppos">
   <xsl:number count="appendix" format="A" />
  </xsl:variable>
  <h2>Appendix
  <xsl:value-of select="$apppos"/> : <xsl:call-template name="namelink"/>
  </h2>
  <xsl:apply-templates/>
  <ul>
  <xsl:for-each select="//rpm">
    <xsl:sort select="."/>
    <xsl:if test="not(@note='exclude')">
      <xsl:variable name="thisrpm" select="."/>
      <xsl:if test="not(preceding::rpm=$thisrpm)">
        <li class="square"><xsl:value-of select="$thisrpm"/></li>
      </xsl:if>
    </xsl:if>
  </xsl:for-each>
  </ul>
  </xsl:if>

 <xsl:if test="@type='f'">
  <xsl:variable name="apppos">
   <xsl:number count="appendix" format="A" />
  </xsl:variable>
  <h2>Appendix
  <xsl:value-of select="$apppos"/> : <xsl:call-template name="namelink"/>
  </h2>
  <xsl:apply-templates/>
  <ul>
  <xsl:for-each select="//f">
    <xsl:sort select="."/>
    <xsl:if test="not(@note='exclude')">
      <xsl:variable name="thisfile" select="."/>
      <xsl:if test="not(preceding::f=$thisfile)">
        <li class="circle"><xsl:value-of select="$thisfile"/></li>
      </xsl:if>
    </xsl:if>
  </xsl:for-each>
  </ul>
  </xsl:if>

 <xsl:if test="@type='c'">
  <xsl:variable name="apppos">
   <xsl:number count="appendix" format="A" />
  </xsl:variable>
  <h2>Appendix
  <xsl:value-of select="$apppos"/> : <xsl:call-template name="namelink"/>
  </h2>
  <xsl:apply-templates/>
  <ul>
  <xsl:for-each select="//c">
    <xsl:sort select="."/>
    <xsl:if test="not(@note='exclude')">
      <xsl:variable name="thiscmd" select="."/>
      <xsl:if test="not(preceding::c=$thiscmd)">
        <li class="circle"><xsl:value-of select="$thiscmd"/></li>
      </xsl:if>
    </xsl:if>
  </xsl:for-each>
  </ul>
  </xsl:if>
</xsl:template>

<xsl:template match="date">
 <xsl:if test="@created">
   <xsl:text>Created: </xsl:text>
   <xsl:value-of select="@created"/><br/>
 </xsl:if>
 <xsl:text>Last Modified: </xsl:text>
 <xsl:value-of select="date:day-abbreviation()"/>
 <xsl:text> </xsl:text>
 <xsl:value-of select="date:month-abbreviation()"/>
 <xsl:text> </xsl:text>
 <xsl:value-of select="date:day-in-month()"/>
 <xsl:text> </xsl:text>
 <xsl:value-of select="date:hour-in-day()"/>
 <xsl:text>:</xsl:text>
 <xsl:value-of select="date:minute-in-hour()"/>
 <xsl:text> </xsl:text>
 <xsl:value-of select="date:year()"/>
</xsl:template>

<xsl:template match="footer">
 <hr/>
 <address>
 <xsl:choose>
  <xsl:when test="$this_author_contact">
    <xsl:text>Contact: </xsl:text>
    <a>
     <xsl:attribute name="href">
      <xsl:value-of select="$this_author_contact"/>
     </xsl:attribute>
     <xsl:value-of select="$this_author_contact"/>
    </a>
  </xsl:when>
  <xsl:otherwise>
   <xsl:if test="$this_author_email">
    <a>
     <xsl:attribute name="href">
     <xsl:text>mailto:</xsl:text>
     <xsl:value-of select="$this_author_email"/>
     </xsl:attribute>
     <xsl:value-of select="$this_author_name"/>
    </a>
   </xsl:if>
  </xsl:otherwise>
 </xsl:choose>
 <br/>
 <xsl:apply-templates/>
 <xsl:if test="$this_copyright">
   <br/>
   <span class="copyright">
   <a>
     <xsl:attribute name="href">
     <xsl:value-of select="$this_copyright_link"/>
     </xsl:attribute>
     <xsl:attribute name="target">
     <xsl:text>_new</xsl:text>
     </xsl:attribute>
     <xsl:value-of select="$this_copyright"/>
   </a>
   </span>
 </xsl:if>
 </address>
</xsl:template>

</xsl:stylesheet>
<!--
to fix or enhance:
-add the following tags to the xml doc.: <space/> <note/>
-implement an index-type tag so that an important point in the 
 doc can be hyperlinked by this stylesheet.
 -->