Unwanted whitespace after xsl:value-of when using fop

Discussion in 'XML' started by Brynjar Glesnes, Aug 26, 2004.

  1. 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
     
    Brynjar Glesnes, Aug 26, 2004
    #1
    1. Advertising

  2. 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.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Aug 26, 2004
    #2
    1. Advertising

  3. Martin Honnen <> wrote in message news:<412de5c9$0$6616$-online.net>...
    > 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.


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

    Brynjar
     
    Brynjar Glesnes, Aug 30, 2004
    #3
  4. In article <>,
    Brynjar Glesnes <> wrote:
    % Martin Honnen <> wrote in message
    % news:<412de5c9$0$6616$-online.net>...
    % > 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.
    %
    % 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)"/>,

    --

    Patrick TJ McPhee
    East York Canada
     
    Patrick TJ McPhee, Aug 31, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Edward
    Replies:
    2
    Views:
    11,219
    DerekLittle
    May 18, 2007
  2. Veerle
    Replies:
    0
    Views:
    1,131
    Veerle
    Apr 7, 2005
  3. Pablo
    Replies:
    0
    Views:
    1,019
    Pablo
    Mar 28, 2007
  4. Replies:
    10
    Views:
    803
    Eric Brunel
    Dec 16, 2008
  5. rroo
    Replies:
    1
    Views:
    106
Loading...

Share This Page