[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xsl-list
Subject:    RE: [xsl] XSL-FO preformatted text issue
From:       "Lynn Hales" <lhales () cox ! net>
Date:       2012-09-18 17:22:49
Message-ID: 000001cd95c2$3a7e1d30$af7a5790$ () cox ! net
[Download RAW message or body]

Steve,

Dave's solution will work, but being more a schema developer than stylesheet writer, \
I would consider a schema change. 

Attempting to format text using spaces and tabs is an iffy situation even outside of \
the XML world. Change fonts and you may be totally messed up. 

I'd look at adding child elements to <pre> for each specific type of information \
(e.g., 'single' then the 'sections').  Rather than <pre> being just a string, make it \
a repeatable selection of exemption and one or more sections. Then you can format \
each element as needed. 

If you cannot make that change consider adding the XML version of Dave's solution \
which is an attribute on <pre> of 'xml:space="preserve".  <pre xml:space="preserve">.

Lynn

-----Original Message-----
From: DaveP [mailto:davep@dpawson.co.uk] 
Sent: Saturday, September 15, 2012 2:08 AM
To: xsl-list@lists.mulberrytech.com
Subject: Re: [xsl] XSL-FO preformatted text issue

On 09/14/2012 03:20 PM, Steve.Wisniewski@thomsonreuters.com wrote:
> Hi,
> 
> I'm having an issue trying to keep line breaks preformatted text. Here's what I am \
> wrapping the preformatted text with: 
> <fo:block font-family="monospace" white-space-collapse="false" \
> wrap-option="no-wrap"> <xsl:apply-templates/>
> </fo:block>
> 
> So, when I get data like this:
> 
> <pre>
> Single individual...   Sec. 1(a)(1)...   Sec. 1(a)(2)...  Sec. 1(c).
> Head of a
> household.........   Sec. 1(b)(1)...   Sec. 1(b)(2)...  Sec. 1(b).
> Married individual
> filing a separate
> return............   Sec. 1(a)(1)...   Sec. 1(a)(2)...  Sec. 1(d).
> Estates and
> trusts............   Sec. 1(a)(1)...   Sec. 1(a)(2)...  Sec. 1(d).
> </pre>
> 
> I want to export it to FO the same way. What I get is this (line breaks not \
> preserved): 
> Single individual... Sec. 1(a)(1)... Sec. 1(a)(2)... Sec. 1(c). Head of \
> ahousehold......... Sec. 1(b)(1)... Sec. 1(b)(2)... Sec. 1(b). Married \
> individualfiling a separate return............ Sec. 1(a)(1)... Sec. 1(a)(2)... Sec. \
> 1(d).Estates andtrusts............ Sec. 1(a)(1)... Sec. 1(a)(2)... Sec. 1(d). 
> I am using Apache FOP 0.95. I am fairly new to FOP so any help would be greatly \
> appreciated! 
> -Steve Wisniewski


http://www.dpawson.co.uk/xsl/sect3/tlayout.html#d13325e306


<fo:block white-space-treatment="preserve"
           linefeed-treatment="preserve"
           whitespace-collapse="false"
           font-family="monospace">
    <!-- YOUR CODE HERE -->
<fo:block>

HTH



regards

-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@lists.mulberrytech.com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@lists.mulberrytech.com>
--~--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic