Re: [xsl] HTML Tidy on FO files

Subject: Re: [xsl] HTML Tidy on FO files
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 8 Nov 2001 12:56:01 +0000
Hi Gustaf,

> I wish to remove all unnecessary linebreaks inside <fo:block>
> elements.

What about using the linefeed-treatment property in XSL to remove them
for you (or turn them into whitespaces):

<fo:block linefeed-treatment="treat-as-space">No
linebreaks
<fo:inline font-weight="bold">here</fo:inline>, please.</fo:block>

should render exactly the same as:

<fo:block>No linebreaks <fo:inline font-weight="bold">here</fo:inline>, please.</fo:block>

without you having to put it through HTML Tidy (which seems to be the
thing causing the problem!). But the linefeed-treatment property
defaults to treat-as-space so the fact that you resorted to HTML Tidy
in the first place implies that this wasn't working for you anyway?

So alternatively, in the XSLT that you're using, you could replace the
linefeed characters with a single space with:

<xsl:template match="text()">
  <xsl:value-of select="translate(., '&#xA;', ' ')" />
</xsl:template>

That would (probably) make Saxon and Xalan output:

<fo:block>No linebreaks <fo:inline font-weight="bold">here</fo:inline>, please.</fo:block>

in the first place. (Only probably because it depends a bit on what
your stylesheet looks like now.)

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread