Unwanted whitespace after xsl:value-of when using fop

B

Brynjar Glesnes

Hi,

I've browsed the Fop FAQ, usenet and the internet hoping to find a
solution to my problem, but in vain.

I am using Xerces 2.6.2, Xalan-J 2.6.0 and Fop 0.20-5 to create
PDF-documents. In the rendered PDF there is an unwanted whitespace
after each xsl:value-of.

An example: What I want to render to "Doe, John" renders to "Doe ,
John".

At least in the Nordic languages this looks wrong. Here is my XSL and
my XML:

XSL:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:call-template name="mastersetup"/>
<xsl:apply-templates/>
</fo:root>
</xsl:template>
<xsl:template name="mastersetup">
<fo:layout-master-set>
<fo:simple-page-master master-name="a4"
page-height="297.00mm"
page-width="210.00mm"
margin-top="0.00mm"
margin-bottom="0.00mm"
margin-left="0.00mm"
margin-right="0.00mm">
<fo:region-before
margin-top="0.00mm"
margin-bottom="0.00mm"
margin-left="0.00mm"
margin-right="0.00mm"/>
<fo:region-body
margin-top="45.00mm"
margin-bottom="10.00mm"
margin-left="35.00mm"
margin-right="10.00mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
</xsl:template>
<xsl:template match="Person">
<fo:page-sequence master-reference="a4">
<fo:static-content flow-name="xsl-region-before">
<fo:block-container background-color="transparent"
border-style="solid"
border-width="0.00mm"
border-color="#000000"
position="absolute"
left="30.00mm"
top="30.00mm"
width="100.00mm"
height="5.00mm"
padding-top="0.00mm"
padding-left="0.00mm"
padding-right="0.00mm"
padding-bottom="0.00mm"
text-align="start"
line-height="10pt"
font-family="Helvetica"
color="#000000"
font-size="8pt"
font-style="normal"
font-weight="normal">
<fo:block>
<xsl:value-of select="LastName"/>, <xsl:value-of
select="FirstName"/>
</fo:block>
</fo:block-container>
<fo:block/>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block/>
</fo:flow>
</fo:page-sequence>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>

XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<Person>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
</Person>

Have anyone experienced the same? Is this a known bug? Is it a
feature? I would be grateful if anyone have a solution to my problem.

Regards
Brynjar Glesnes
 
M

Martin Honnen

Brynjar Glesnes wrote:

<fo:block>
<xsl:value-of select="LastName"/>, <xsl:value-of
select="FirstName"/>

Try whether
<xsl:value-of select="LastName" /><xsl:text>,
</xsl:text><xsl:value-of select="FirstName" />
improves things.
 
B

Brynjar Glesnes

Martin Honnen said:
Brynjar Glesnes wrote:



Try whether
<xsl:value-of select="LastName" /><xsl:text>,
</xsl:text><xsl:value-of select="FirstName" />
improves things.

Thank you for your answer. Unfortunately this made no difference.

Brynjar
 
P

Patrick TJ McPhee

% >
% >
% > > <fo:block>
% > > <xsl:value-of select="LastName"/>, <xsl:value-of
% > > select="FirstName"/>
% >
% > Try whether
% > <xsl:value-of select="LastName" /><xsl:text>,
% > </xsl:text><xsl:value-of select="FirstName" />
% > improves things.
%
% Thank you for your answer. Unfortunately this made no difference.

It looks to me like there's white-space in the data of your LastName
element. Try

<xsl:value-of select="normalize-space(LastName)"/>,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top