[patch] libfo-compat.xsl and significant space

Tim Waugh <[email protected]> Fri, 10 Jun 2005 18:08:38 +0100
Newsgroups gmane.text.xml.xmlroff.general
Message-ID <[email protected]>
Hi,

Here is a patch against current CVS that fixes whitespace handling in
libfo-compat.xsl.

Index: libfo-compat.xsl
===================================================================
RCS file: /cvsroot/xmlroff/xmlroff/libfo-compat.xsl,v
retrieving revision 1.9
diff -d -u -r1.9 libfo-compat.xsl
--- libfo-compat.xsl	1 May 2005 19:07:09 -0000	1.9
+++ libfo-compat.xsl	10 Jun 2005 17:07:53 -0000
@@ -50,9 +50,6 @@
 
   <xsl:output method="xml"/>
 
-  <xsl:strip-space elements="*"/>
-  <xsl:preserve-space elements="fo:title fo:block fo:bidi-override fo:inline fo:leader fo:basic-link fo:multi-case fo:multi-toggle fo:wrapper fo:marker"/>
-
   <xsl:param name="verbose" select="false()"/>
 
   <xsl:template match="/">
@@ -62,6 +59,17 @@
     <xsl:apply-templates/>
   </xsl:template>
   
+  <xsl:template match="text()">
+    <xsl:if test="contains(' &#xA;',substring(.,1,1))">
+      <xsl:text> </xsl:text>
+    </xsl:if>
+    <xsl:value-of select="normalize-space()"/>
+    <xsl:if test="string-length() > 1 and
+                  contains(' &#xA;',substring(.,string-length(),1))">
+      <xsl:text> </xsl:text>
+    </xsl:if>
+  </xsl:template>
+
   <xsl:template match="fo:list-item-label/text()">
     <xsl:if test="$verbose">
       <xsl:message>Correcting text child of fo:list-item-label by removing text</xsl:message>

Tim.
*/
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCqckVHU/d4jnpWe0RAlCVAJ99xAn5vC6CfDKiISd43Xii0cydeQCgiY6A
EtEZTVTYyZUE4qDwvCcgHNA=
=gpPw
-----END PGP SIGNATURE-----