summaryrefslogtreecommitdiffstats
path: root/src/documentation/stylesheets/doclist2document.xsl
blob: 4219c6351939071caaf3c95cc05a9199cc405ee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?xml version="1.0"?>

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">

 <xsl:template match="doclist">
  <document>
   <header>
    <title>List of all documentation</title>
   </header>
   <body>
    <s1 title="Documentation List">
     <p>
      This complete list shows, at a glance, how all of the documentation
      fits together within the hierarchy of sections.
<!--      For an overview of the documentation see the new
      &quot;Table of Contents&quot;. -->
     </p>
     <p>
      The side-panel of each actual document is used to reach other documents
      that are relevant to that section. The side-panel will change, according
      to that section's location in the documentation hierarchy.
     </p>
    </s1>
    <xsl:apply-templates/>
   </body>
  </document>
 </xsl:template>

 <xsl:template match="book">
  <s1 title="{@title}">
   <xsl:if test="position()=1">
    <p>This first section is a list of the top-level documentation
     (and is a replica of this page's side-panel).</p>
   </xsl:if>
   <xsl:apply-templates/>
  </s1>
 </xsl:template>

 <xsl:template match="menu">
  <xsl:if test="@label!='Navigation'">
  <p><strong><xsl:value-of select="@label"/></strong></p>
   <ul>
    <xsl:apply-templates>
     <xsl:with-param name="uri" select="../@uri"/>
    </xsl:apply-templates>
   </ul>
  </xsl:if>
 </xsl:template>

 <xsl:template match="menu-item">
  <xsl:param name="uri"/>
  <xsl:if test="not(@type) or @type!='hidden'">
   <xsl:if test="@label!='Main' and @label!='User Documentation'">
<!-- FIXME: ensure href is not full URL scheme:// -->
<!--
  (uri=<xsl:value-of select="$uri"/> href=<xsl:value-of select="@href"/>)
-->
    <li><link href="{$uri}{@href}"><xsl:value-of select="@label"/></link>
    </li>
   </xsl:if>
  </xsl:if>
 </xsl:template>

 <xsl:template match="external">
  <xsl:param name="uri"/>
  <xsl:if test="not(@type) or @type!='hidden'">
   <xsl:choose>
    <!-- FIXME: specially handle menu item "API (Javadoc)", it causes a bug. -->
    <xsl:when test="starts-with(@label,'API')">
     <li><link href="http://xml.apache.org/cocoon/apidocs/"><xsl:value-of select="@label"/></link></li>
<!-- FIXME: here is the bug:
     <li><link href="{@href}"><xsl:value-of select="@label"/></link></li>
     <li><xsl:value-of select="@label"/>href=<xsl:value-of select="@href"/></li>
-->
    </xsl:when>
    <xsl:otherwise>
     <li><link href="{@href}"><xsl:value-of select="@label"/></link></li>
    </xsl:otherwise>
   </xsl:choose>
  </xsl:if>
 </xsl:template>

</xsl:stylesheet>