[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: <br/> in FO?

Subject: Re: <br/> in FO?
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Wed, 27 Feb 2002 16:07:45 +0100
fo br
"Gustaf Liljegren" <gustaf.liljegren@xxxxxx> wrote:
> I've found a reason for a <br/> tag in my DTD, and I wonder how to implement
> it in the XSL (to FO).

You have already been told that the FO equivalent of HTML

 <p>Stuff<br>more stuff</p>

is preferably

   <fo:block>more stuff</fo:block>

You asked also how to get from something resembling the first to the
second. This is easy if the <br/> is a immediate child of the <p>, one
solution is

 <xsl:template match="p">
       <xsl:apply-templates select="node()[not(previous-sibling::br)]"/>
     <xsl:for-each select="br">

or you can handle it as a more general grouping problem, see the XSLT FAQ.
If the <br/> could be nested, for example

 <p><em>Important Stuff<br/>more important stuff</em></p>

i can only think of a multipass solution which pulls up the <br/> to direct
child level, thereby splitting all elements it contains. (Not recommended
hack: use disable-output-escaping to generate "lone" tags)

If the above becomes unpracticable, you can have the FO processor honor
linefeed by setting the linefeed-treatment property to preserve.
(http://www.w3.org/TR/xsl/slice7.html#linefeed-treatment) That's more
of a kludge and may give unexpected results in some contexts, but you
might get a cheap shot. Inserting dummy blocks
 <xsl:template match="br">
(perhaps with some modifications) might also be a cheap if brittle solution
in you concrete case.


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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.