]> granicus.if.org Git - docbook-dsssl/commitdiff
Grand Unification: Epilogue (2): If "neighboring" text nodes in
authorMichael Smith <xmldoc@users.sourceforge.net>
Sun, 22 May 2005 12:25:26 +0000 (12:25 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Sun, 22 May 2005 12:25:26 +0000 (12:25 +0000)
mixed content are whitespace-only, apply the special sauce just
before serving; that is, at the end, not both at the beginning and
at the end.

xsl/manpages/docbook.xsl

index 454d2e20d5ee65d002ffe995737cecaafce7a71f..25d07a5f56190fb9915122acda728cb2a8ed8192 100644 (file)
        <!-- content gets preserved; without the hack, that whitespace -->
        <!-- effectively gets gobbled. -->
 
-       <!-- Note the last part of the two tests below; if the node is just -->
-       <!-- space, we just pass it through without doing our special magic -->
-       <!-- on it. -->
+       <!-- Note if the node is just space, we just pass it through -->
+       <!-- without (re)adding a line break. -->
        
        <!-- There must be a better way to do with this...  -->
         <xsl:variable name="content">
        <xsl:if
            test="translate(substring(., string-length(.), 1),'&#x9;&#10;&#13; ','    ')  = ' '
                  and following-sibling::node()[name(.)!='']
-                 and normalize-space($content) != ''
                  ">
-         <xsl:text> &#10;</xsl:text>
+         <xsl:text> </xsl:text>
+         <xsl:if test="normalize-space($content) != ''">
+           <xsl:text>&#10;</xsl:text>
+         </xsl:if>
        </xsl:if>
       </xsl:when>
       <xsl:otherwise>