1<?xml version="1.0" encoding="utf-8"?> 2 3<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 4 <xsl:output method="html" 5 indent="yes" 6 doctype-public="-//W3C//DTD HTML 4.01//EN" 7 doctype-system="http://www.w3.org/TR/html4/strict.dtd"/> 8 <!-- <xsl:strip-space elements="*"/> --> 9 10 <xsl:param name="this-man" select="/refentry/refmeta/refentrytitle"/> 11 12 <xsl:include href="head.xsl"/> 13 <xsl:include href="toc.xsl"/> 14 <xsl:include href="cmdsynopsis.xsl"/> 15 16 <xsl:template name="generate-anchor"> 17 <xsl:value-of select="if (not(@id)) then generate-id(title) else @id"/> 18 </xsl:template> 19 20 <xsl:template match="/"> 21 <xsl:apply-templates select="refentry"/> 22 </xsl:template> 23 24 <xsl:template match="title"/> 25 26 <xsl:template match="abbrev | classname | code | command | constant | filename | foreignphrase | function | literal | option | parameter | varname"> 27 <span class="{name()}"><xsl:apply-templates/></span> 28 </xsl:template> 29 30 <xsl:template match="productname"> 31 <span class="productname"><xsl:apply-templates/></span> 32 <sup><xsl:text>(tm)</xsl:text></sup> 33 </xsl:template> 34 35 <xsl:template match="important"> 36 <div class="important"> 37 <p class="important-title">Important:</p> 38 <xsl:apply-templates/> 39 </div> 40 </xsl:template> 41 42 <xsl:template match="note"> 43 <div class="note"> 44 <p class="note-title">Note:</p> 45 <xsl:apply-templates/> 46 </div> 47 </xsl:template> 48 49 <xsl:template match="programlisting | screen"> 50 <pre class="{name()}"><xsl:apply-templates mode="no-markup"/></pre> 51 </xsl:template> 52 53 <xsl:template match="refentry"> 54 <html> 55 <xsl:call-template name="head"/> 56 <body> 57 <div class="heading"> 58 <xsl:apply-templates select="refnamediv/refname"/> 59 <xsl:text> -- </xsl:text> 60 <xsl:apply-templates select="refnamediv/refpurpose"/> 61 </div> 62 <hr/> 63 <xsl:call-template name="toc"/> 64 <xsl:call-template name="content"/> 65 </body> 66 </html> 67 </xsl:template> 68 69 <xsl:template name="content"> 70 <div class="content"> 71 <xsl:for-each select="refsynopsisdiv | refsect1"> 72 <xsl:if test="name() = 'refsetc1'"> 73 <hr/> 74 </xsl:if> 75 <h1> 76 <xsl:variable name="anchor"> 77 <xsl:call-template name="generate-anchor"/> 78 </xsl:variable> 79 <a name="{$anchor}"> 80 <xsl:number format="1. " value="position()"/> 81 <xsl:value-of select="title"/> 82 </a> 83 </h1> 84 85 <xsl:apply-templates/> 86 </xsl:for-each> 87 </div> 88 </xsl:template> 89 90 <xsl:template match="refsect2"> 91 <h2> 92 <xsl:variable name="anchor"> 93 <xsl:call-template name="generate-anchor"/> 94 </xsl:variable> 95 <a name="{$anchor}"> 96 <xsl:number level="multiple" format="1. " count="refsynopsisdiv|refsect1|refsect2"/> 97 <xsl:value-of select="title"/> 98 </a> 99 </h2> 100 101 <xsl:apply-templates/> 102 </xsl:template> 103 104 <xsl:template match="emphasis"> 105 <em><xsl:apply-templates/></em> 106 </xsl:template> 107 108 <xsl:template match="para"> 109 <p><xsl:apply-templates/></p> 110 </xsl:template> 111 112 <xsl:template match="link"> 113 <a href="#{@linkend}"><xsl:value-of select="."/></a> 114 </xsl:template> 115 116 <xsl:template match="ulink"> 117 <a href="{@url}"><xsl:value-of select="."/></a> 118 </xsl:template> 119 120 <xsl:template match="uri"> 121 <a href="{.}"><xsl:value-of select="."/></a> 122 </xsl:template> 123 124 <xsl:template match="variablelist"> 125 <table class="variablelist"> 126 <thead> 127 <tr> 128 <th>Option</th> 129 <th>Description</th> 130 </tr> 131 </thead> 132 133 <tbody> 134 <xsl:apply-templates select="varlistentry"/> 135 </tbody> 136 </table> 137 </xsl:template> 138 139 <xsl:template match="varlistentry"> 140 <tr> 141 <td class="varlistoption"> 142 <xsl:choose> 143 <xsl:when test="@id"><a name="{@id}"><xsl:apply-templates select="term"/></a></xsl:when> 144 <xsl:otherwise><xsl:apply-templates select="term"/></xsl:otherwise> 145 </xsl:choose> 146 </td> 147 <td><xsl:apply-templates select="listitem"/></td> 148 </tr> 149 </xsl:template> 150 151 <xsl:template match="refname | refpurpose | term | varlistentry/listitem"> 152 <xsl:apply-templates/> 153 </xsl:template> 154 155 <xsl:template match="orderedlist"> 156 <ol> 157 <xsl:copy-of select="@id"/> 158 <xsl:apply-templates/> 159 </ol> 160 </xsl:template> 161 162 <xsl:template match="itemizedlist"> 163 <ul> 164 <xsl:copy-of select="@id"/> 165 <xsl:apply-templates/> 166 </ul> 167 </xsl:template> 168 169 <xsl:template match="orderedlist/listitem | itemizedlist/listitem"> 170 <li> 171 <xsl:apply-templates/> 172 </li> 173 </xsl:template> 174 175 <xsl:template match="optional"> 176 <xsl:text>[</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text> 177 </xsl:template> 178 179 <xsl:template match="citerefentry"> 180 <xsl:choose> 181 <xsl:when test="$this-man = refentrytitle"> 182 <span class="productname"><xsl:value-of select="refentrytitle"/></span> 183 <xsl:text>(</xsl:text><xsl:value-of select="manvolnum"/><xsl:text>)</xsl:text> 184 </xsl:when> 185 <xsl:when test="matches(refentrytitle, '^mkv')"> 186 <a href="{refentrytitle}.html"> 187 <span class="productname"><xsl:value-of select="refentrytitle"/></span> 188 <xsl:text>(</xsl:text><xsl:value-of select="manvolnum"/><xsl:text>)</xsl:text> 189 </a> 190 </xsl:when> 191 <xsl:otherwise> 192 <a href="http://linux.die.net/man/{manvolnum}/{refentrytitle}" > 193 <span class="productname"><xsl:value-of select="refentrytitle"/></span> 194 <xsl:text>(</xsl:text><xsl:value-of select="manvolnum"/><xsl:text>)</xsl:text> 195 </a> 196 </xsl:otherwise> 197 </xsl:choose> 198 </xsl:template> 199</xsl:stylesheet> 200