You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

doclist2document.xsl 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4. version="1.0">
  5. <xsl:template match="doclist">
  6. <document>
  7. <header>
  8. <title>List of all documentation</title>
  9. </header>
  10. <body>
  11. <s1 title="Documentation List">
  12. <p>
  13. This complete list shows, at a glance, how all of the documentation
  14. fits together within the hierarchy of sections.
  15. <!-- For an overview of the documentation see the new
  16. &quot;Table of Contents&quot;. -->
  17. </p>
  18. <p>
  19. The side-panel of each actual document is used to reach other documents
  20. that are relevant to that section. The side-panel will change, according
  21. to that section's location in the documentation hierarchy.
  22. </p>
  23. </s1>
  24. <xsl:apply-templates/>
  25. </body>
  26. </document>
  27. </xsl:template>
  28. <xsl:template match="book">
  29. <s1 title="{@title}">
  30. <xsl:if test="position()=1">
  31. <p>This first section is a list of the top-level documentation
  32. (and is a replica of this page's side-panel).</p>
  33. </xsl:if>
  34. <xsl:apply-templates/>
  35. </s1>
  36. </xsl:template>
  37. <xsl:template match="menu">
  38. <xsl:if test="@label!='Navigation'">
  39. <p><strong><xsl:value-of select="@label"/></strong></p>
  40. <ul>
  41. <xsl:apply-templates>
  42. <xsl:with-param name="uri" select="../@uri"/>
  43. </xsl:apply-templates>
  44. </ul>
  45. </xsl:if>
  46. </xsl:template>
  47. <xsl:template match="menu-item">
  48. <xsl:param name="uri"/>
  49. <xsl:if test="not(@type) or @type!='hidden'">
  50. <xsl:if test="@label!='Main' and @label!='User Documentation'">
  51. <!-- FIXME: ensure href is not full URL scheme:// -->
  52. <!--
  53. (uri=<xsl:value-of select="$uri"/> href=<xsl:value-of select="@href"/>)
  54. -->
  55. <li><link href="{$uri}{@href}"><xsl:value-of select="@label"/></link>
  56. </li>
  57. </xsl:if>
  58. </xsl:if>
  59. </xsl:template>
  60. <xsl:template match="external">
  61. <xsl:param name="uri"/>
  62. <xsl:if test="not(@type) or @type!='hidden'">
  63. <xsl:choose>
  64. <!-- FIXME: specially handle menu item "API (Javadoc)", it causes a bug. -->
  65. <xsl:when test="starts-with(@label,'API')">
  66. <li><link href="http://xml.apache.org/cocoon/apidocs/"><xsl:value-of select="@label"/></link></li>
  67. <!-- FIXME: here is the bug:
  68. <li><link href="{@href}"><xsl:value-of select="@label"/></link></li>
  69. <li><xsl:value-of select="@label"/>href=<xsl:value-of select="@href"/></li>
  70. -->
  71. </xsl:when>
  72. <xsl:otherwise>
  73. <li><link href="{@href}"><xsl:value-of select="@label"/></link></li>
  74. </xsl:otherwise>
  75. </xsl:choose>
  76. </xsl:if>
  77. </xsl:template>
  78. </xsl:stylesheet>