From 4dee2dc78463b1844857eb8707fb5f5a956982df Mon Sep 17 00:00:00 2001 From: Mauritz Jeanson <mj@johanneberg.com> Date: Tue, 10 Jul 2007 20:41:35 +0000 Subject: [PATCH] Added fixes to avoid duplicate ids when generate.id.attributes = 1. This (hopefully) closes bug #1671052. --- xsl/html/component.xsl | 14 ++++++++------ xsl/html/division.xsl | 12 +++++++----- xsl/html/sections.xsl | 5 ++++- xsl/html/titlepage.xsl | 4 +++- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/xsl/html/component.xsl b/xsl/html/component.xsl index dc6e8038f..ed2edac7a 100644 --- a/xsl/html/component.xsl +++ b/xsl/html/component.xsl @@ -36,11 +36,13 @@ <xsl:element name="h{$level+1}"> <xsl:attribute name="class">title</xsl:attribute> - <xsl:call-template name="anchor"> - <xsl:with-param name="node" select="$node"/> - <xsl:with-param name="conditional" select="0"/> - </xsl:call-template> - <xsl:apply-templates select="$node" mode="object.title.markup"> + <xsl:if test="$generate.id.attributes = 0"> + <xsl:call-template name="anchor"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="conditional" select="0"/> + </xsl:call-template> + </xsl:if> + <xsl:apply-templates select="$node" mode="object.title.markup"> <xsl:with-param name="allow-anchors" select="1"/> </xsl:apply-templates> </xsl:element> @@ -371,7 +373,7 @@ </div> </xsl:template> -<xsl:template match="article/title" mode="titlepage.mode" priority="2"> +<xsl:template match="article/title|article/articleinfo/title" mode="titlepage.mode" priority="2"> <xsl:call-template name="component.title"> <xsl:with-param name="node" select="ancestor::article[1]"/> </xsl:call-template> diff --git a/xsl/html/division.xsl b/xsl/html/division.xsl index 67369bcd3..d7b42ddb3 100644 --- a/xsl/html/division.xsl +++ b/xsl/html/division.xsl @@ -212,11 +212,13 @@ <h1> <xsl:attribute name="class">title</xsl:attribute> - <xsl:call-template name="anchor"> - <xsl:with-param name="node" select="$node"/> - <xsl:with-param name="conditional" select="0"/> - </xsl:call-template> - <xsl:apply-templates select="$node" mode="object.title.markup"> + <xsl:if test="$generate.id.attributes = 0"> + <xsl:call-template name="anchor"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="conditional" select="0"/> + </xsl:call-template> + </xsl:if> + <xsl:apply-templates select="$node" mode="object.title.markup"> <xsl:with-param name="allow-anchors" select="1"/> </xsl:apply-templates> </h1> diff --git a/xsl/html/sections.xsl b/xsl/html/sections.xsl index a2fa6cff0..b85e4627e 100644 --- a/xsl/html/sections.xsl +++ b/xsl/html/sections.xsl @@ -465,12 +465,15 @@ <xsl:attribute name="style">clear: both</xsl:attribute> </xsl:if> </xsl:if> - <xsl:if test="$allow-anchors != 0"> + <xsl:if test="$allow-anchors != 0 and $generate.id.attributes = 0"> <xsl:call-template name="anchor"> <xsl:with-param name="node" select="$section"/> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> </xsl:if> + <xsl:if test="$generate.id.attributes != 0 and not(local-name(.) = 'appendix')"> + <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute> + </xsl:if> <xsl:copy-of select="$title"/> </xsl:element> </xsl:template> diff --git a/xsl/html/titlepage.xsl b/xsl/html/titlepage.xsl index cc54b756f..da9361fc9 100644 --- a/xsl/html/titlepage.xsl +++ b/xsl/html/titlepage.xsl @@ -944,7 +944,9 @@ <h1> <xsl:apply-templates select="." mode="class.attribute"/> - <a name="{$id}"/> + <xsl:if test="$generate.id.attributes = 0"> + <a name="{$id}"/> + </xsl:if> <xsl:choose> <xsl:when test="$show.revisionflag != 0 and @revisionflag"> <span class="{@revisionflag}"> -- 2.40.0