You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2010/05/09 12:30:25 UTC

svn commit: r942518 - /tomcat/site/trunk/xdocs/stylesheets/tomcat-site.xsl

Author: kkolinko
Date: Sun May  9 10:30:25 2010
New Revision: 942518

URL: http://svn.apache.org/viewvc?rev=942518&view=rev
Log:
It is port of r941463 from Tomcat trunk.
More anchor handling improvements:
1) escape '#' character as well as spaces. See virtual-hosting-howto.html for an example.
2) allow to explicitly specify anchor name, using anchor="" attribute on a (sub)section. See default-servlet.html for an example.

Modified:
    tomcat/site/trunk/xdocs/stylesheets/tomcat-site.xsl

Modified: tomcat/site/trunk/xdocs/stylesheets/tomcat-site.xsl
URL: http://svn.apache.org/viewvc/tomcat/site/trunk/xdocs/stylesheets/tomcat-site.xsl?rev=942518&r1=942517&r2=942518&view=diff
==============================================================================
--- tomcat/site/trunk/xdocs/stylesheets/tomcat-site.xsl (original)
+++ tomcat/site/trunk/xdocs/stylesheets/tomcat-site.xsl Sun May  9 10:30:25 2010
@@ -177,10 +177,17 @@
   <!-- Process a documentation section -->
   <xsl:template match="section">
     <xsl:variable name="name">
-      <xsl:value-of select="@name"/>
+      <xsl:choose>
+        <xsl:when test="@anchor">
+          <xsl:value-of select="@anchor" />
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@name"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:variable>
     <xsl:variable name="name2">
-      <xsl:value-of select="translate($name, ' ', '_')"/>
+      <xsl:value-of select="translate($name, ' #', '__')"/>
     </xsl:variable>
     <table border="0" cellspacing="0" cellpadding="2" width="100%">
       <!-- Section heading -->
@@ -214,15 +221,22 @@
   <!-- Process a documentation subsection -->
   <xsl:template match="subsection">
     <xsl:variable name="name">
-      <xsl:if test="
-          count(//*[(local-name()='section' or local-name()='subsection') and @name=current()/@name]) &gt; 1
-          ">
-        <xsl:value-of select="concat(ancestor::section/@name, '/')"/>
-      </xsl:if>
-      <xsl:value-of select="@name"/>
+      <xsl:choose>
+        <xsl:when test="@anchor">
+          <xsl:value-of select="@anchor" />
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="
+              count(//*[(local-name()='section' or local-name()='subsection') and @name=current()/@name]) &gt; 1
+              ">
+            <xsl:value-of select="concat(ancestor::section/@name, '/')"/>
+          </xsl:if>
+          <xsl:value-of select="@name"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:variable>
     <xsl:variable name="name2">
-      <xsl:value-of select="translate($name, ' ', '_')"/>
+      <xsl:value-of select="translate($name, ' #', '__')"/>
     </xsl:variable>
     <table border="0" cellspacing="0" cellpadding="2" width="100%">
       <!-- Subsection heading -->
@@ -248,15 +262,22 @@
 
   <xsl:template mode="toc" match="section|subsection">
     <xsl:variable name="name">
-      <xsl:if test="local-name()='subsection' and 
-          count(//*[(local-name()='section' or local-name()='subsection') and @name=current()/@name]) &gt; 1
-          ">
-        <xsl:value-of select="concat(ancestor::section/@name, '/')"/>
-      </xsl:if>
-      <xsl:value-of select="@name"/>
+      <xsl:choose>
+        <xsl:when test="@anchor">
+          <xsl:value-of select="@anchor" />
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="local-name()='subsection' and 
+              count(//*[(local-name()='section' or local-name()='subsection') and @name=current()/@name]) &gt; 1
+              ">
+            <xsl:value-of select="concat(ancestor::section/@name, '/')"/>
+          </xsl:if>
+          <xsl:value-of select="@name"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:variable>
     <xsl:variable name="name2">
-      <xsl:value-of select="translate($name, ' ', '_')"/>
+      <xsl:value-of select="translate($name, ' #', '__')"/>
     </xsl:variable>
     <li><a href="#{$name2}"><xsl:value-of select="@name"/></a>
     <xsl:if test="subsection">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org