openSUSE / suse-xsl

DocBook XSL Stylesheets for SUSE branding
Other
11 stars 10 forks source link

Fix #398: Disable intra-xrefs #399

Closed tomschr closed 4 years ago

tomschr commented 4 years ago

This PR fixes #398 and contains:

Co-authored-by: Stefan Knorr

tomschr commented 4 years ago

After your comment, I've played around a bit. I think, I've found now an even better solution.

The basic idea is almost the same for FO and HTML: you stuff everything (including any FO or HTML nodes) into the variable rtf. With exsl:node-set() you create a node set from your result tree fragment (rtf). As the link are the first element in the node, you skip this link node and copy everything underneath to your end format.

For FO it looks like this (same for HTML, but with span instead of <fo:inline>):

<xsl:when test="$xref.in.samebook = 0 and @xrefstyle">
    <xsl:variable name="rtf">
        <xsl:apply-imports/>
    </xsl:variable>
    <xsl:variable name="node" select="exsl:node-set($rtf)/*"/>

    <fo:inline xsl:use-attribute-sets="xref.basic.properties">
        <xsl:copy-of select="$node/node()"/>
    </fo:inline>
</xsl:when>

I've tested it and it works quite well: the text is not clickable anymore and it preserves the formatting whatever is in its title.

ghost commented 4 years ago

Thanks!