xsl-list
[Top] [All Lists]

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

2005-05-04 05:18:47
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/


--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--