[prev in list] [next in list] [prev in thread] [next in thread]
List: forrest-dev
Subject: cvs commit: xml-forrest/src/resources/skins/forrest-css/xslt/html document2html.xsl
From: crossley () apache ! org
Date: 2003-08-30 5:26:48
[Download RAW message or body]
crossley 2003/08/29 22:26:48
Modified: src/documentation skinconf.xml
. status.xml
src/resources/fresh-site/src/documentation skinconf.xml
src/resources/schema/relaxng skinconf.rnc
src/resources/skins/common/xslt/html document2html.xsl
src/resources/skins/forrest-css/xslt/html document2html.xsl
Log:
Generated Tables of Contents can show a configurable number of section levels.
Submitted by: Ramon Prades rprades<AT>porcelanosa.com
Revision Changes Path
1.7 +9 -1 xml-forrest/src/documentation/skinconf.xml
Index: skinconf.xml
===================================================================
RCS file: /home/cvs/xml-forrest/src/documentation/skinconf.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- skinconf.xml 1 Apr 2003 13:15:59 -0000 1.6
+++ skinconf.xml 30 Aug 2003 05:26:48 -0000 1.7
@@ -12,7 +12,7 @@
<!ELEMENT skinconfig (disable-search?, disable-print-link?, disable-pdf-link?,
disable-xml-link?, disable-compliance-links?, searchsite-domain?, searchsite-name?,
project-name, project-url, project-logo, group-name?, group-url?, group-logo?,
- host-url?, host-logo?, year?, vendor?, trail?, credits?)*>
+ host-url?, host-logo?, year?, vendor?, trail?, toc?, credits?)*>
<!ELEMENT credits (credit*)>
<!ELEMENT credit (name, url, image?, width?, height?)>
<!-- id uniquely identifies the tool, and role indicates its function -->
@@ -48,6 +48,8 @@
<!ELEMENT image (#PCDATA)>
<!ELEMENT width (#PCDATA)>
<!ELEMENT height (#PCDATA)>
+ <!ELEMENT toc EMPTY>
+ <!ATTLIST toc level CDATA #IMPLIED>
]>
<skinconfig>
@@ -94,6 +96,12 @@
<link2 name="xml.apache" href="http://xml.apache.org/"/>
<link3 name="" href=""/>
</trail>
+
+ <!-- Configure how many "section" levels need to be included in the
+ generated Table of Contents (TOC). By default, if no toc element is provided
+ below, then 2 levels are included. Level 0 does not generate any TOC at all.
+ -->
+ <toc level="2"/>
<!-- Credits are typically rendered as a set of small clickable images in the
page footer -->
1.190 +10 -4 xml-forrest/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/xml-forrest/status.xml,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -r1.189 -r1.190
--- status.xml 16 Aug 2003 14:56:42 -0000 1.189
+++ status.xml 30 Aug 2003 05:26:48 -0000 1.190
@@ -25,11 +25,17 @@
<changes>
<release version="0.5-dev" date="unreleased">
+ <action dev="DC" type="update" context="skins"
+ due-to="Ramon Prades" due-to-email="rprades@porcelanosa.com" >
+ The generated Tables of Contents can be configured to show a certain
+ number of section levels. Default is two levels. Level 0 means show
+ no ToC at all. See the fresh-site skinconf.xml for example usage.
+ </action>
<action dev="JT" type="update" context="core">
New 'expand-dtd' target for generating monolithic DTDs suitable for use
in catalog-ignorant XML editors such as IDEA.
</action>
- <action dev="JJP" type="fix" context="skin"
+ <action dev="JJP" type="fix" context="skins"
due-to="J.Pietschmann" due-to-email="pietsch@apache.org" >
Allow images to scale on pdf output.
</action>
@@ -51,11 +57,11 @@
Remove indent attr from the xsl:output as it is define on serializer.
Move xsl:output for *2document.xsl to "xml-document" serializer.
</action>
- <action dev="JJP" type="fix" context="skin"
+ <action dev="JJP" type="fix" context="skins"
due-to="Eirik Bjørsnøs" due-to-email="bjorsnos@stud.ntnu.no" >
abstract element was ignored for html output.
</action>
- <action dev="JJP" type="fix" context="skin"
+ <action dev="JJP" type="fix" context="skins"
due-to="Ramón Prades" due-to-email="rprades@porcelanosa.com" >
Unescape strings, so they display propertly on the trail for all skins.
</action>
@@ -63,7 +69,7 @@
due-to="Dave Brondsema" due-to-email="dave@brondsema.net" >
Use sync task to clean the tmp directory for xdocs.
</action>
- <action dev="NKB" type="add" context="skin">
+ <action dev="NKB" type="add" context="skins">
Now the Krysalis skin has javascript-collapsable menus.
</action>
<action dev="JT" type="update" context="core">
1.12 +9 -1 xml-forrest/src/resources/fresh-site/src/documentation/skinconf.xml
Index: skinconf.xml
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/fresh-site/src/documentation/skinconf.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- skinconf.xml 4 Jul 2003 13:48:47 -0000 1.11
+++ skinconf.xml 30 Aug 2003 05:26:48 -0000 1.12
@@ -12,7 +12,7 @@
<!ELEMENT skinconfig (disable-search?, disable-print-link?, disable-pdf-link?,
disable-xml-link?, disable-compliance-links?, searchsite-domain?, searchsite-name?,
project-name, project-url, project-logo, group-name?, group-url?, group-logo?,
- host-url?, host-logo?, year?, vendor?, trail?, credits?)*>
+ host-url?, host-logo?, year?, vendor?, trail?, toc?, credits?)*>
<!ELEMENT credits (credit*)>
<!ELEMENT credit (name, url, image?, width?, height?)>
<!-- id uniquely identifies the tool, and role indicates its function -->
@@ -48,6 +48,8 @@
<!ELEMENT image (#PCDATA)>
<!ELEMENT width (#PCDATA)>
<!ELEMENT height (#PCDATA)>
+ <!ELEMENT toc EMPTY>
+ <!ATTLIST toc level CDATA #IMPLIED>
]>
<skinconfig>
@@ -98,6 +100,12 @@
<link2 name="myProject" href="http://xml.apache.org/"/>
<link3 name="" href=""/>
</trail>
+
+ <!-- Configure how many "section" levels need to be included in the
+ generated Table of Contents (TOC). By default, if no toc element is provided
+ below, then 2 levels are included. Level 0 does not generate any TOC at all.
+ -->
+ <toc level="2"/>
<!-- Credits are typically rendered as a set of small clickable images in the
page footer -->
1.5 +1 -0 xml-forrest/src/resources/schema/relaxng/skinconf.rnc
Index: skinconf.rnc
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/schema/relaxng/skinconf.rnc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- skinconf.rnc 18 Mar 2003 08:50:39 -0000 1.4
+++ skinconf.rnc 30 Aug 2003 05:26:48 -0000 1.5
@@ -24,6 +24,7 @@
element year {text}?, # Used in Copyright
element vendor {text}?, # Used in Copyright
trail?, # 'Breadcrumbs' trail in skins that support it
+ element toc {(attribute level {text})}?, # toc generation
credits?
)*
}
1.22 +46 -28 xml-forrest/src/resources/skins/common/xslt/html/document2html.xsl
Index: document2html.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/common/xslt/html/document2html.xsl,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- document2html.xsl 7 Aug 2003 12:26:09 -0000 1.21
+++ document2html.xsl 30 Aug 2003 05:26:48 -0000 1.22
@@ -27,7 +27,16 @@
<xsl:variable name="disable-print-link" select="$config/disable-print-link"/>
<!-- If true, an XML link for this page will not be generated -->
<xsl:variable name="disable-xml-link" select="$config/disable-xml-link"/>
-
+ <!-- Get the section depth to use when generating the minitoc (default is 2) -->
+ <xsl:variable name="config-max-depth" select="$config/toc/@level"/>
+ <xsl:variable name="max-depth">
+ <xsl:choose>
+ <xsl:when test="string-length($config-max-depth)>0">
+ <xsl:value-of select="$config-max-depth"/>
+ </xsl:when>
+ <xsl:otherwise>2</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<xsl:param name="notoc"/>
<xsl:param name="path"/>
@@ -145,23 +154,11 @@
</xsl:template>
<xsl:template match="body">
- <xsl:if test="section and not($notoc='true')">
- <ul class="minitoc">
- <xsl:for-each select="section">
- <li>
- <xsl:call-template name="toclink"/>
- <xsl:if test="section">
- <ul class="minitoc">
- <xsl:for-each select="section">
- <li>
- <xsl:call-template name="toclink"/>
- </li>
- </xsl:for-each>
- </ul>
- </xsl:if>
- </li>
- </xsl:for-each>
- </ul>
+ <xsl:if test="$max-depth>0 and not($notoc='true')" >
+ <xsl:call-template name="minitoc">
+ <xsl:with-param name="tocroot" select="."/>
+ <xsl:with-param name="depth">1</xsl:with-param>
+ </xsl:call-template>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
@@ -330,16 +327,37 @@
</xsl:attribute>
</xsl:template>
+ <xsl:template name="minitoc">
+ <xsl:param name="tocroot"/>
+ <xsl:param name="depth"/>
+ <ul class="minitoc">
+ <xsl:for-each select="$tocroot/section">
+ <xsl:call-template name="toclink"/>
+ <xsl:if test="$depth<$max-depth">
+ <xsl:call-template name="minitoc">
+ <xsl:with-param name="tocroot" select="."/>
+ <xsl:with-param name="depth" select="$depth + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </ul>
+ </xsl:template>
+
<xsl:template name="toclink">
- <a>
- <xsl:attribute name="href">
- <xsl:text>#</xsl:text>
- <xsl:if test="@id">
- <xsl:value-of select="@id"/>
- </xsl:if>
- </xsl:attribute>
- <xsl:value-of select="title"/>
- </a>
+ <xsl:variable name="tocitem" select="normalize-space(title)"/>
+ <xsl:if test="string-length($tocitem)>0">
+ <li>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:text>#</xsl:text>
+ <xsl:if test="@id">
+ <xsl:value-of select="@id"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:value-of select="$tocitem"/>
+ </a>
+ </li>
+ </xsl:if>
</xsl:template>
<xsl:template match="abstract">
1.3 +39 -28 xml-forrest/src/resources/skins/forrest-css/xslt/html/document2html.xsl
Index: document2html.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/skins/forrest-css/xslt/html/document2html.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- document2html.xsl 17 Jul 2003 11:41:18 -0000 1.2
+++ document2html.xsl 30 Aug 2003 05:26:48 -0000 1.3
@@ -48,36 +48,47 @@
</xsl:template>
<xsl:template match="body">
- <xsl:if test="section and not($notoc='true')">
- <ul>
- <xsl:for-each select="section">
- <li>
- <a>
- <xsl:attribute name="href">
- <xsl:text>#</xsl:text><xsl:call-template name="generate-id"/>
- </xsl:attribute>
- <xsl:value-of select="title"/>
- </a>
- <xsl:if test="section">
- <ul>
- <xsl:for-each select="section">
- <li>
- <a>
- <xsl:attribute name="href">
- <xsl:text>#</xsl:text><xsl:call-template name="generate-id"/>
- </xsl:attribute>
- <xsl:value-of select="title"/>
- </a>
- </li>
- </xsl:for-each>
- </ul>
- </xsl:if>
- </li>
- </xsl:for-each>
- </ul>
+ <xsl:if test="$max-depth>0 and not($notoc='true')" >
+ <xsl:call-template name="minitoc">
+ <xsl:with-param name="tocroot" select="."/>
+ <xsl:with-param name="depth">1</xsl:with-param>
+ </xsl:call-template>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
+
+ <xsl:template name="toclink">
+ <xsl:variable name="tocitem" select="normalize-space(title)"/>
+ <xsl:if test="string-length($tocitem)>0">
+ <li>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:text>#</xsl:text><xsl:call-template name="generate-id"/>
+ </xsl:attribute>
+ <xsl:value-of select="$tocitem"/>
+ </a>
+ </li>
+ </xsl:if>
+ </xsl:template>
+
+
+
+ <xsl:template name="minitoc">
+ <xsl:param name="tocroot"/>
+ <xsl:param name="depth"/>
+ <ul>
+ <xsl:for-each select="$tocroot/section">
+ <xsl:call-template name="toclink"/>
+ <xsl:if test="$depth<$max-depth">
+ <xsl:call-template name="minitoc">
+ <xsl:with-param name="tocroot" select="."/>
+ <xsl:with-param name="depth" select="$depth + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </ul>
+ </xsl:template>
+
<xsl:template name="generate-id">
<xsl:choose>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic