Replace spaces with underscore in HTML anchor names.
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 5 May 2010 15:45:21 +0000 (15:45 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 5 May 2010 15:45:21 +0000 (15:45 +0000)
To preserve compatibility each (sub)section will now generate two anchors:
the old one and the new one, if they differ.
It is port of r936982 from tomcat/site

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@941356 13f79535-47bb-0310-9956-ffa450edef68

webapps/docs/tomcat-docs.xsl

index c3b05ca..7497c43 100644 (file)
     <xsl:variable name="name">
       <xsl:value-of select="@name"/>
     </xsl:variable>
+    <xsl:variable name="name2">
+      <xsl:value-of select="translate($name, ' ', '_')"/>
+    </xsl:variable>
     <table border="0" cellspacing="0" cellpadding="2">
       <!-- Section heading -->
       <tr><td bgcolor="{$banner-bg}">
           <font color="{$banner-fg}" face="arial,helvetica.sanserif">
-          <a name="{$name}">
+          <xsl:if test="$name != $name2"><a name="{$name}"><xsl:comment>()</xsl:comment></a></xsl:if>
+          <a name="{$name2}">
           <strong><xsl:value-of select="@name"/></strong></a></font>
         </td>
       <xsl:if test="@rtext">
       </xsl:if>
       <xsl:value-of select="@name"/>
     </xsl:variable>
+    <xsl:variable name="name2">
+      <xsl:value-of select="translate($name, ' ', '_')"/>
+    </xsl:variable>
     <table border="0" cellspacing="0" cellpadding="2">
       <!-- Subsection heading -->
       <tr><td bgcolor="{$sub-banner-bg}">
           <font color="{$sub-banner-fg}" face="arial,helvetica.sanserif">
-          <a name="{$name}">
+          <xsl:if test="$name != $name2"><a name="{$name}"><xsl:comment>()</xsl:comment></a></xsl:if>
+          <a name="{$name2}">
           <strong><xsl:value-of select="@name"/></strong></a></font>
       </td></tr>
       <!-- Subsection body -->
       </xsl:if>
       <xsl:value-of select="@name"/>
     </xsl:variable>
-    <li><a href="#{$name}"><xsl:value-of select="@name"/></a>
+    <xsl:variable name="name2">
+      <xsl:value-of select="translate($name, ' ', '_')"/>
+    </xsl:variable>
+    <li><a href="#{$name2}"><xsl:value-of select="@name"/></a>
     <xsl:if test="subsection">
       <ol><xsl:apply-templates mode="toc" select="subsection"/></ol>
     </xsl:if>