Author: bdube Date: Thu Jan 20 03:55:43 2011 New Revision: 1061113 URL: http://svn.apache.org/viewvc?rev=1061113&view=rev Log: Suppress extra generated id when converting xdoc sections to html
Some discussion: http://www.gossamer-threads.com/lists/forrest/dev/37977 Modified: forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl forrest/trunk/main/webapp/skins/pelt/xslt/html/document-to-html.xsl Modified: forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl?rev=1061113&r1=1061112&r2=1061113&view=diff ============================================================================== --- forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl (original) +++ forrest/trunk/main/webapp/skins/common/xslt/html/document-to-html.xsl Thu Jan 20 03:55:43 2011 @@ -91,8 +91,14 @@ Section handling </xsl:template> <!-- Generate a <a name="..."> tag for an @id --> <xsl:template match="@id"> - <xsl:if test="normalize-space(.)!=''"><a name="{.}"/> - </xsl:if> + <xsl:choose> + <xsl:when test="normalize-space(.) != ''"> + <a name="{.}"/> + </xsl:when> + <xsl:otherwise> + <a name="{generate-id()}"/> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="section"> <!-- count the number of section in the ancestor-or-self axis to compute Modified: forrest/trunk/main/webapp/skins/pelt/xslt/html/document-to-html.xsl URL: http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/pelt/xslt/html/document-to-html.xsl?rev=1061113&r1=1061112&r2=1061113&view=diff ============================================================================== --- forrest/trunk/main/webapp/skins/pelt/xslt/html/document-to-html.xsl (original) +++ forrest/trunk/main/webapp/skins/pelt/xslt/html/document-to-html.xsl Thu Jan 20 03:55:43 2011 @@ -92,7 +92,7 @@ imported document-to-html.xsl for detail <xsl:template match="@id"> <xsl:apply-imports/> </xsl:template> - <xsl:template match="section"><a name="{generate-id()}"/> + <xsl:template match="section"> <xsl:apply-templates select="@id"/> <xsl:variable name = "level" select = "count(ancestor::section)+1" /> <xsl:choose>