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

Re: XSL-FO / XSLT Transformations & Line Breaks in XML

Subject: Re: XSL-FO / XSLT Transformations & Line Breaks in XML
From: JBryant@xxxxxxxxx
Date: Wed, 4 May 2005 09:20:39 -0500
xslt line break
<xsl:template match="publications/header">

<fo:block
space-before="30pt"
space-after="30pt">
<xsl:value-of select="heading"/>
</fo:block>

<fo:block
space-before="30pt"
space-after="30pt">
<xsl:apply-templates select="para"/>
</fo:block>

</xsl:template>

<xsl:template match="linebreakhere">
  <fo:block/>
</xsl:template>

In your FO file, you'll end up with a stucture like this:

<fo:block space-before="30pt" space-after="30pt">
  Text of some heading
</fo:block>
<fo:block space-before="30pt" space-after="30pt">
  The part of the para before the linebreakhere element <fo:block/> 
followed by the rest of the para.
</fo:block>

You can assign properties to the empty block as needed.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)






"craig webber" <craigwebber@xxxxxxxxxxx> 
05/04/2005 07:18 AM
Please respond to
xsl-list@xxxxxxxxxxxxxxxxxxxxxx


To
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
cc

Subject
Re:  XSL-FO / XSLT Transformations & Line Breaks in XML






For arbitrary breaks, the XSLT processor needs to be able to recognize
something, so you need an element in the middle of the text, thus:

<para1>Banana Strawberry<break/>Grape Cherry</para1>

Then you can do:

<xsl:template match="para1">
   <p><xsl:apply-templates/></p>
</xsl:match>

<xsl:template match="break">
   <br/>
</xsl:match>


*** ***

This is working fine in my XSLT transfrom. But not in my XSL-FO transfrom 
(both use the same XML file).

I've used the following code in my XSL-FO file:

<xsl:template match="publications/header">

<fo:block
space-before="30"
space-after="30">
<xsl:value-of select="heading"/>
</fo:block>

<fo:block
space-before="30"
space-after="30">
<xsl:value-of select="para"/>
</fo:block>

</xsl:template>

<xsl:template match="publications/header/para/linebreakhere">

<fo:block
space-before="30"
space-after="30">
<xsl:value-of select="."/>
</fo:block>

</xsl:template>

And the line break appears in my XML file as follows:

<publications>
<header>

<heading>
Consultations Database
</heading>

<para>
The Department of Trade and Industry values the views of business, 
consumer 
groups and the public. We know that we will get it right delivering policy 

if we have consulted effectively.

<linebreakhere/>

The DTI seeks views on a range of proposals and existing policies, both 
through formal written consultations and through informal contact and 
discussion. We use a variety of consultation methods to ensure 
participation 
from a diversity of individuals and organisations/business.
</para>

</header>
</publications>

Any help would be great.

Thanks,

Craig.

_________________________________________________________________
Get news headlines and download FREE stuff - visit MSN South Africa! 
http://www.msn.co.za/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.