toc2html.xsl 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <!-- ***************************************************************
  4. VampyreDoc Tool
  5. XSL stylesheet which transforms VampyreDoc contents XML file to
  6. XHTML page.
  7. **************************************************************** -->
  8. <xsl:output method="xml" encoding="utf-8" indent="yes"
  9. doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  10. doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
  11. <xsl:template match="toc">
  12. <html>
  13. <!-- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  14. this adds ugly empty xmlns="" attribute to many elements
  15. when transforming with Saxon -->
  16. <head>
  17. <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  18. <meta name="generator" content="VampyreDoc"/>
  19. <link href="../common/doc.css" type="text/css" rel="stylesheet"/>
  20. <link href="../../common/doc.css" type="text/css" rel="stylesheet"/>
  21. <title>
  22. <xsl:choose>
  23. <xsl:when test="title!=''">
  24. <xsl:value-of select="title"/>
  25. </xsl:when>
  26. <xsl:otherwise>
  27. Contents
  28. </xsl:otherwise>
  29. </xsl:choose>
  30. </title>
  31. </head>
  32. <body>
  33. <div class="tocbody">
  34. <xsl:call-template name="title"/>
  35. <xsl:apply-templates select="itemlist"/>
  36. </div>
  37. </body>
  38. </html>
  39. </xsl:template>
  40. <!-- ***********************************
  41. TOC Elements
  42. *********************************** -->
  43. <xsl:template name="title">
  44. <xsl:if test="title!=''">
  45. <span class="toctitle">
  46. <xsl:value-of select="title"/>
  47. </span>
  48. </xsl:if>
  49. </xsl:template>
  50. <xsl:template match="itemlist">
  51. <ul class="toc">
  52. <xsl:apply-templates select="item"/>
  53. </ul>
  54. </xsl:template>
  55. <xsl:template match="item">
  56. <li class="toc">
  57. <a target="docview">
  58. <xsl:attribute name="href">
  59. <xsl:value-of select="@url"/>
  60. </xsl:attribute>
  61. <xsl:value-of select="@name"/>
  62. </a>
  63. <xsl:apply-templates select="itemlist"/>
  64. </li>
  65. </xsl:template>
  66. </xsl:stylesheet>