Hi Sam,
I don't think using normalize-space() would be satisfactory, because that function returns text only, and would remove the html markup that makes it a cross reference. Applying normalize-space to the xref would return nothing, because an xref element is empty.

You don't want to mess with the markup, only with the text nodes of cross reference targets that contain carriage returns. There is no specific mode for that, but the no.anchor.mode comes close. It is used when generating cross references because it prevents nested links (i.e., no link anchors inside the link text). Since that is a mode, you can use it to match only the text nodes in titles as follows to map any line feeds in the title to spaces:

<xsl:template match="title/text()" mode="no.anchor.mode">
 <xsl:value-of select="translate(., '&#10;', '&#32;')"/>
</xsl:template>

This seems to work, and I haven't noticed any side effects, but be sure to test it.

Bob Stayton
Sagehill Enterprises
[email protected]


----- Original Message ----- From: "Sam Steingold" <[email protected]>
To: <[email protected]>
Sent: Friday, June 26, 2009 8:22 AM
Subject: [docbook-apps] line breaks in </lineannotation>


Hi,
if you look at
http://clisp.podval.org/impnotes/mt.html#mt-unsafe
you will see a spurious line break:

(INCF (GETHASH x global-ht 0)) ; see Section 32.5.2.5, “Hash Tables,
Sequences, and other
 mutable objects”

there should not be a line break between "other" and "mutable".

the sources (http://clisp.podval.org/impnotes-src.zip) impext.xml:

-----------------------------------
<section id="mt-mutable"><title>Hash Tables, Sequences, and other
 mutable objects</title>
...
<programlisting language="lisp">
(&incf; (&gethash; x global-ht 0))<lineannotation>see <xref
linkend="mt-mutable"/></lineannotation>
....
-----------------------------------

template:

-----------------------------------
<xsl:template match="programlisti...@language = 'lisp']/lineannotation">
<strong>&#9;;&#160;</strong> <!-- TAB + ; + &nbsp; -->
<xsl:apply-imports/>
</xsl:template>
-----------------------------------

my question is: should I use normalize-space myself
(the following is probably wrong, I hope you will correct that for me):

-----------------------------------
<xsl:template match="programlisti...@language = 'lisp']/lineannotation">
<strong>&#9;;&#160;</strong> <!-- TAB + ; + &nbsp; -->
<xsl:value-of select="normalize-space(.)"><xsl:apply-imports/></xsl:value-of>
</xsl:template>
-----------------------------------

or is this a bug which could be fixed at the source?

thanks!

--
Sam Steingold <http://sds.podval.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to