[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Adjusting trailing punctuation after <xref>
My question concerns the handling of trailing punctuation following the closing double quote generated by the <xref> mechanism. Suppose I have this input: <para> Configuration options and configuration file syntax are described in <xref linkend="using-config-files"/>. </para> Running the document containing that paragraph results in output like this: Configuration options and configuration file syntax are described in Section 4, "Using Configuration Files". Note that the trailing period appears after the closing double quote. What I would like to do is have trailing punctuation (such as period, question or exclamation mark, comma, colon, semicolon)) move inside the closing double quote, like this: Configuration options and configuration file syntax are described in Section 4, "Using Configuration Files." I suspect that achieving this requires two things: 1. The <xref> mechanism must examine the following element to see if it's a text node that begins with a punctuation character and use the character in the cross-reference if it is. 2. There needs to be a template for text nodes that follow <xref> such that the template strips off the first character if it's one of the punctuation characters. The second part of that can be done like this: <xsl:template match="text()[preceding-sibling::*[1][self::xref]]"> <xsl:choose> <xsl:when test="contains('.?!,:;', substring(., 1, 1))"> <xsl:value-of select="substring(., 2)" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="." /> </xsl:otherwise> </xsl:choose> </xsl:template> But is there a way to do the first part? I have spent some time looking at some of the <xref> machinery in the stylesheets, but I'm afraid that I can only admire it as deep wizardry, with little understanding of what I'm looking at. :-)
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]