Subject: Re: [xsl] XSL-FO / XSLT Transformations & Line Breaks in XML From: Jim Melton <jim.melton@xxxxxxx> Date: Wed, 04 May 2005 07:03:06 -0600 |
tells the XSLT processor to extract the string value of the para element contained in the header element. That extracts *all* of the text in the paragraph and completely ignores the linebreakhere element because it has no string value.<fo:block space-before="30" space-after="30"> <xsl:value-of select="para"/> </fo:block>
but define another template to handle the para element. A very rough approximation of the XSLT might look something like this:<fo:block space-before="30" space-after="30"> <xsl:apply-templates/> </fo:block>
<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:apply-templates/> </fo:block>
</xsl:template>
<xsl:template match="publications/header/para">
<fo:block space-before="30" space-after="30"> <xsl:apply-templates/> </fo:block>
</xsl:template>
<xsl:template match="linebreakhere">
<fo:block/>
</xsl:template>
Hope this helps, Jim
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSL-FO / XSLT Transformat, Greg Gaffney | Thread | Re: [xsl] XSL-FO / XSLT Transformat, JBryant |
RE: [xsl] XSL-FO / XSLT Transformat, Greg Gaffney | Date | [xsl] XMPSpy and Xalan, Maria Amuchastegui |
Month |