xmltoman.xsl 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
  3. <!--
  4. This file is part of ifmetric.
  5. ifmetric is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 2 of the License, or (at your
  8. option) any later version.
  9. ifmetric is distributed in the hope that it will be useful, but WITHOUT
  10. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with ifmetric; if not, write to the Free Software Foundation,
  15. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  16. -->
  17. <xsl:template match="/manpage">
  18. <xsl:text disable-output-escaping="yes">
  19. &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  20. </xsl:text>
  21. <html>
  22. <head>
  23. <title>
  24. <xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)
  25. </title>
  26. <link rel="stylesheet" type="text/css" href="xmltoman.css"/>
  27. </head>
  28. <body>
  29. <h1>Name</h1>
  30. <p><xsl:value-of select="@name"/>
  31. <xsl:if test="string-length(@desc) &gt; 0">
  32. - <xsl:value-of select="@desc"/>
  33. </xsl:if>
  34. </p>
  35. <xsl:apply-templates />
  36. </body>
  37. </html>
  38. </xsl:template>
  39. <xsl:template match="p">
  40. <p>
  41. <xsl:apply-templates/>
  42. </p>
  43. </xsl:template>
  44. <xsl:template match="cmd">
  45. <p class="cmd">
  46. <xsl:apply-templates/>
  47. </p>
  48. </xsl:template>
  49. <xsl:template match="arg">
  50. <span class="arg"><xsl:apply-templates/></span>
  51. </xsl:template>
  52. <xsl:template match="opt">
  53. <span class="opt"><xsl:apply-templates/></span>
  54. </xsl:template>
  55. <xsl:template match="file">
  56. <span class="file"><xsl:apply-templates/></span>
  57. </xsl:template>
  58. <xsl:template match="optdesc">
  59. <div class="optdesc">
  60. <xsl:apply-templates/>
  61. </div>
  62. </xsl:template>
  63. <xsl:template match="synopsis">
  64. <h1>Synopsis</h1>
  65. <xsl:apply-templates/>
  66. </xsl:template>
  67. <xsl:template match="seealso">
  68. <h1>Synopsis</h1>
  69. <xsl:apply-templates/>
  70. </xsl:template>
  71. <xsl:template match="description">
  72. <h1>Description</h1>
  73. <xsl:apply-templates/>
  74. </xsl:template>
  75. <xsl:template match="options">
  76. <h1>Options</h1>
  77. <xsl:apply-templates/>
  78. </xsl:template>
  79. <xsl:template match="section">
  80. <h1><xsl:value-of select="@name"/></h1>
  81. <xsl:apply-templates/>
  82. </xsl:template>
  83. <xsl:template match="option">
  84. <div class="option"><xsl:apply-templates/></div>
  85. </xsl:template>
  86. <xsl:template match="manref">
  87. <xsl:choose>
  88. <xsl:when test="string-length(@href) &gt; 0">
  89. <a class="manref"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</a>
  90. </xsl:when>
  91. <xsl:otherwise>
  92. <span class="manref"><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</span>
  93. </xsl:otherwise>
  94. </xsl:choose>
  95. </xsl:template>
  96. <xsl:template match="url">
  97. <a class="url"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@href"/></a>
  98. </xsl:template>
  99. </xsl:stylesheet>