What I mean by white-space-preserve does not work means that my
company_address becomes:  282 Quarry Rd Milford, CT 06460 and loses the line
breaks, plus any additional spacing  (tabs, multiples spaces, new lines,
etc).
I have put a more complete style sheet at the end as well.   I would like to
avoid breaking up the address into 2 separate blocks because this is just
one example of where I need to preserve line breaks.  Most of the scenarios
are of user input where they would like to preserve as much formatting as
possible.

I appreciate all of your help.  This has been plaguing our reports generated
through FOP for a long time now.
-David Rosenstein
IMS Software
http://www.ims-usa.com



<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xlink="http://www.w3.org/2000/xlink/namespace/";
xmlns:fo="http://www.w3.org/1999/XSL/Format"; xmlns:date="java.util.Date"
xmlns:format="java.text.SimpleDateFormat" exclude-result-prefixes="date
format">
        <xsl:output method="xml" indent="no"/>
        <xsl:variable name="footnotecounter" select="0"/>
        <xsl:variable name="spaceAfter">4pt</xsl:variable>
        <xsl:variable name="tableWidth">18cm</xsl:variable>
        <xsl:template match="/">
                <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
                        <!-- defines the layout master -->
                        <fo:layout-master-set>
                                <fo:simple-page-master master-name="formula" 
page-height="28cm"
page-width="21.5cm" margin-top="1cm" margin-bottom=".5cm" margin-left="2cm"
margin-right="2cm">
                                        <fo:region-body margin-top="2.5cm" 
margin-bottom="2cm"/>
                                        <fo:region-before extent="2.4cm"/>
                                        <fo:region-after extent="1.5cm"/>
                                </fo:simple-page-master>
                        </fo:layout-master-set>
                        <!-- starts actual layout -->
                        <xsl:for-each select="root">
                                <xsl:call-template name="formulaTableTemplate"/>
                        </xsl:for-each>
                </fo:root>
        </xsl:template>
        <fo:page-sequence master-reference="formula">
                <fo:flow flow-name="xsl-region-body">
                <!--SECTION 1 HEADER-->
                        <fo:table padding="0mm" width="{$tableWidth}" 
padding-start="1mm"
space-after.optimum="9pt" table-layout="fixed">
                                <fo:table-column column-width="11cm"/>
                                <fo:table-column column-width="6cm"/>
                                <fo:table-body>
                                        <fo:table-row space-after.optimum="5pt">
                                                <fo:table-cell>
                                                        <fo:block 
font-family="sans-serif" font-size="10pt"
space-after.optimum="{$spaceAfter}">
                                                                <fo:inline 
font-weight="bold" font-family="sans-serif"
font-size="10pt" text-decoration="underline">Manufacturer's
Name:</fo:inline>
                                                                <xsl:value-of 
select="COMPANY_NAME"/>
                                                        </fo:block>
                                                </fo:table-cell>
                                                <fo:table-cell>
                                                        <fo:block 
font-family="sans-serif" font-size="10pt"
space-after.optimum="{$spaceAfter}">
                                                        </fo:block>
                                                </fo:table-cell>
                                        </fo:table-row>
                                        <fo:table-row space-after.optimum="5pt" 
height="3cm">
                                                <fo:table-cell>
                                                        <fo:block 
font-family="sans-serif" font-size="10pt"
space-after.optimum="{$spaceAfter}" white-space-treatment="preserve"
white-space-collapse="false" text-align="start"><xsl:value-of
select="COMPANY_ADDRESS" /></fo:block>
                                                </fo:table-cell>
                                                <fo:table-cell>
                                                        <fo:block 
font-family="sans-serif" font-size="10pt"
space-after.optimum="{$spaceAfter}">
                                                        </fo:block>
                                                </fo:table-cell>
                                        </fo:table-row>
                                        <fo:table-row space-after.optimum="5pt">
                                                <fo:table-cell>
                                                        <fo:block 
font-family="sans-serif" font-size="10pt"
space-after.optimum="{$spaceAfter}">
                                                                <fo:inline 
font-weight="bold" font-family="sans-serif"
font-size="10pt" text-decoration="underline">Prepared:</fo:inline>
                                                                <fo:leader 
leader-pattern="rule" leader-length="3mm" color="white"
rule-thickness=".01pt" rule-style="double" space-after.optimum="4mm" />
                                                                <xsl:variable 
name="pattern">MMMM dd, yyyy</xsl:variable>
                                                                <xsl:variable 
name="SimpleDateFormat"
select="format:new($pattern)"/>
                                                                <xsl:variable 
name="Date" select="date:new()"/>
                                                                <xsl:value-of 
select="format:format($SimpleDateFormat, $Date)"/>

                                                        </fo:block>
                                                </fo:table-cell>
                                                <fo:table-cell>
                                                        <fo:block 
font-family="sans-serif" font-size="10pt"
space-after.optimum="{$spaceAfter}">
                                                        </fo:block>
                                                </fo:table-cell>
                                        </fo:table-row>
                                </fo:table-body>
                        </fo:table>
                        <fo:block id="last-page"></fo:block>
                </fo:flow>
        </fo:page-sequence>
        </xsl:template>
</xsl:stylesheet>


-----Original Message-----
From: Andreas L. Delmelle [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 16, 2003 3:12 PM
To: [EMAIL PROTECTED]
Subject: RE: Changing SAX Class


> -----Original Message-----
> From: David Rosenstein [mailto:[EMAIL PROTECTED]
>
> I did change this line in the template to read:
>
> <fo:block font-family="sans-serif" font-size="10pt"
> space-after.optimum="{$spaceAfter}" white-space-treatment="preserve"
> white-space-collapse="false" text-align="start"><xsl:value-of
> select="COMPANY_ADDRESS" /></fo:block>
>

Just asking, but are you *sure* that it has nothing to do with a surrounding
block? Can you post a more complete XSL-FO?

> and i still see this same indent.  I too originally thought it was finding
> an extra tab in the xml but this seems to not be the case.  Also, if i use
> just white-space-treatment="preserve" alone it has no effect and

The FOP compliance page (http://xml.apache.org/fop/compliance.html)
indicates only basic conformance for this property...

> all of the
> white space is lost.
>

All of it? Or just the newline split? If it's just the latter, perhaps
splitting the address block in two fo:blocks, and removing the white-space-*
properties altogether, could help you out here.

HTH!

Greetz,

Andreas


---------------------------------------------------------------------
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