From: <bob...@us...> - 2012-11-28 00:48:06
|
Revision: 9668 http://docbook.svn.sourceforge.net/docbook/?rev=9668&view=rev Author: bobstayton Date: 2012-11-28 00:47:59 +0000 (Wed, 28 Nov 2012) Log Message: ----------- Implement active links between co and callout elements for PDF output, linking in both directions. Modified Paths: -------------- trunk/xsl/fo/callout.xsl trunk/xsl/fo/lists.xsl Modified: trunk/xsl/fo/callout.xsl =================================================================== --- trunk/xsl/fo/callout.xsl 2012-11-26 23:10:44 UTC (rev 9667) +++ trunk/xsl/fo/callout.xsl 2012-11-28 00:47:59 UTC (rev 9668) @@ -84,14 +84,64 @@ </xsl:template> <xsl:template match="co"> - <fo:inline> - <xsl:call-template name="anchor"/> - <xsl:apply-templates select="." mode="callout-bug"/> - </fo:inline> + <xsl:param name="coref"/> + <!-- link to the callout? --> + <xsl:variable name="linkend"> + <xsl:choose> + <!-- if more than one target, choose the first --> + <xsl:when test="contains(normalize-space(@linkends), ' ')"> + <xsl:value-of select="substring-before(normalize-space(@linkends), ' ')"/> + </xsl:when> + <xsl:when test="string-length(normalize-space(@linkends)) != 0"> + <xsl:value-of select="normalize-space(@linkends)"/> + </xsl:when> + <xsl:otherwise> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:choose> + <xsl:when test="string-length($linkend) != 0"> + <fo:basic-link internal-destination="{$linkend}"> + <xsl:choose> + <xsl:when test="$coref"> + <xsl:call-template name="anchor"> + <xsl:with-param name="node" select="$coref"/> + <xsl:with-param name="conditional" select="0"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="anchor"> + <xsl:with-param name="conditional" select="0"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates select="." mode="callout-bug"/> + </fo:basic-link> + </xsl:when> + <xsl:otherwise> + <fo:inline> + <xsl:choose> + <xsl:when test="$coref"> + <xsl:call-template name="anchor"> + <xsl:with-param name="node" select="$coref"/> + <xsl:with-param name="conditional" select="0"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="anchor"> + <xsl:with-param name="conditional" select="0"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates select="." mode="callout-bug"/> + </fo:inline> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="coref"> - <!-- tricky; this relies on the fact that we can process the "co" that's --> + <!-- this relies on the fact that we can process the "co" that's --> <!-- "over there" as if it were "right here" --> <xsl:variable name="co" select="key('id', @linkend)"/> @@ -109,10 +159,10 @@ </xsl:message> </xsl:when> <xsl:otherwise> - <fo:inline> - <xsl:call-template name="anchor"/> - <xsl:apply-templates select="$co" mode="callout-bug"/> - </fo:inline> + <!-- process it as if it were the co itself --> + <xsl:apply-templates select="$co"> + <xsl:with-param name="coref" select="."/> + </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:template> Modified: trunk/xsl/fo/lists.xsl =================================================================== --- trunk/xsl/fo/lists.xsl 2012-11-26 23:10:44 UTC (rev 9667) +++ trunk/xsl/fo/lists.xsl 2012-11-28 00:47:59 UTC (rev 9668) @@ -1320,7 +1320,9 @@ <xsl:text>: ???</xsl:text> </xsl:when> <xsl:when test="local-name($target)='co'"> - <xsl:apply-templates select="$target" mode="callout-bug"/> + <fo:basic-link internal-destination="{$arearef}"> + <xsl:apply-templates select="$target" mode="callout-bug"/> + </fo:basic-link> </xsl:when> <xsl:when test="local-name($target)='areaset'"> <xsl:call-template name="callout-bug"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |