From: Tim W. <tw...@re...> - 2005-03-09 19:21:19
|
Here is a patch to fix significant space handling in libfo-compat.xsl. This preserves spaces between text nodes and (for example) fo:inline nodes. Tim. */ --- /usr/share/xml/libfo-0.3.1/libfo-compat.xsl 2005-03-09 15:21:42.000000000 +0000 +++ libfo-compat.xsl 2005-03-09 19:20:11.000000000 +0000 @@ -75,7 +75,13 @@ </xsl:template> <xsl:template match="text()"> + <xsl:if test="contains(' 
',substring(.,1,1))"> + <xsl:text> </xsl:text> + </xsl:if> <xsl:value-of select="normalize-space()"/> + <xsl:if test="contains(' 
',substring(.,string-length(),1))"> + <xsl:text> </xsl:text> + </xsl:if> </xsl:template> <xsl:template match="@border"> |
From: Tim W. <tw...@re...> - 2005-06-10 17:08:54
|
Hi, Here is a patch against current CVS that fixes whitespace handling in libfo-compat.xsl. Index: libfo-compat.xsl =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 @@ =20 <xsl:output method=3D"xml"/> =20 - <xsl:strip-space elements=3D"*"/> - <xsl:preserve-space elements=3D"fo:title fo:block fo:bidi-override fo:in= line fo:leader fo:basic-link fo:multi-case fo:multi-toggle fo:wrapper fo:ma= rker"/> - <xsl:param name=3D"verbose" select=3D"false()"/> =20 <xsl:template match=3D"/"> @@ -62,6 +59,17 @@ <xsl:apply-templates/> </xsl:template> =20 + <xsl:template match=3D"text()"> + <xsl:if test=3D"contains(' 
',substring(.,1,1))"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:value-of select=3D"normalize-space()"/> + <xsl:if test=3D"string-length() > 1 and + contains(' 
',substring(.,string-length(),1))"> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:template> + <xsl:template match=3D"fo:list-item-label/text()"> <xsl:if test=3D"$verbose"> <xsl:message>Correcting text child of fo:list-item-label by removing= text</xsl:message> Tim. */ |
From: Tony G. <Ton...@Su...> - 2005-06-12 19:38:12
|
Tim Waugh <tw...@re...> writes: > Here is a patch against current CVS that fixes whitespace handling in > libfo-compat.xsl. Committed. Thank you. Regards, Tony. |
From: Tony G. <Ton...@Su...> - 2005-03-10 00:34:01
|
Tim Waugh <tw...@re...> writes: > Here is a patch to fix significant space handling in > libfo-compat.xsl. This preserves spaces between text nodes and (for > example) fo:inline nodes. Thanks, but instead I added <xsl:preserve-space> and listed all the FOs with #PCDATA in their content model. Please confirm whether or not that does the job. I did check in your region-body patch. Thank you for that. The next question is what to do about the 'unsupported property' warning messages. The attributes representing the unsupported properties could be stripped by libfo-compat.xsl, or the FoLibfoContext warning mode setting could actually be implemented. For the moment, it is easier to add them to libfo-compat.xsl as alternatives in the '@height' template rule. Regards, Tony. |
From: Tim W. <tw...@re...> - 2005-03-10 15:55:43
|
On Thu, Mar 10, 2005 at 12:34:23AM +0000, Tony Graham wrote: > Thanks, but instead I added <xsl:preserve-space> and listed all the > FOs with #PCDATA in their content model. Please confirm whether or > not that does the job. It doesn't. I get things like this: press<fo:inline font-weight="bold">F8</fo:inline>for the menu from a DocBook para fragment that had: press <keycap>F8</keycap> for the menu > or the FoLibfoContext warning mode setting could actually be > implemented. What would be the effect of that? Tim. */ |
From: Tony G. <Ton...@Su...> - 2005-03-10 16:21:10
|
Tim Waugh <tw...@re...> writes: > On Thu, Mar 10, 2005 at 12:34:23AM +0000, Tony Graham wrote: > >> Thanks, but instead I added <xsl:preserve-space> and listed all the >> FOs with #PCDATA in their content model. Please confirm whether or >> not that does the job. > > It doesn't. I get things like this: > > press<fo:inline font-weight="bold">F8</fo:inline>for the menu > > from a DocBook para fragment that had: > > press <keycap>F8</keycap> > for the menu This template rule may be the problem: <xsl:template match="text()"> <xsl:value-of select="normalize-space()"/> </xsl:template> The real problem, for xmlroff, is the whitespace at the beginning of the lines. I'll look again at your whitespace patch. >> or the FoLibfoContext warning mode setting could actually be >> implemented. > > What would be the effect of that? Whatever we want, not least because (a) it's software, and (b) it's software that hasn't been written yet. I was contemplating a warning mode setting to not warn about unsupported properties. Just because I find it useful to be warned about unsupported properties doesn't mean everybody else does. Regards, Tony. |
From: Tim W. <tw...@re...> - 2005-06-10 16:17:48
|
FWIW, the current CVS libfo-compat.xsl still gets significant space wrong. Tim. */ On Thu, Mar 10, 2005 at 04:21:13PM +0000, Tony Graham wrote: > Tim Waugh <tw...@re...> writes: >=20 > > On Thu, Mar 10, 2005 at 12:34:23AM +0000, Tony Graham wrote: > > > >> Thanks, but instead I added <xsl:preserve-space> and listed all the > >> FOs with #PCDATA in their content model. Please confirm whether or > >> not that does the job. > > > > It doesn't. I get things like this: > > > > press<fo:inline font-weight=3D"bold">F8</fo:inline>for the menu > > > > from a DocBook para fragment that had: > > > > press <keycap>F8</keycap> > > for the menu >=20 > This template rule may be the problem: >=20 > <xsl:template match=3D"text()"> > <xsl:value-of select=3D"normalize-space()"/> > </xsl:template> >=20 > The real problem, for xmlroff, is the whitespace at the beginning of > the lines. >=20 > I'll look again at your whitespace patch. [...] |
From: Tim W. <tw...@re...> - 2005-06-10 16:38:48
|
On Fri, Jun 10, 2005 at 05:17:43PM +0100, Tim Waugh wrote: > FWIW, the current CVS libfo-compat.xsl still gets significant space > wrong. Oops, please ignore this. I accidentally used the 0.3.3 libfo-compat.xsl instead of the CVS one. Tim. */ |