You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Rita Greenberg <rg...@medata.com> on 2012/06/22 19:57:11 UTC

White Space Added but Not Needed

Hello.

In my xsl:fo stylesheet I'm using wrap-option="wrap" on a fo:cell level.
I'm printing a hash (#) sign before an xml element if a cetain condition is met.

So, my element has, for example, a value of "28" and if the condition is met I 
want to print #28. The problem is that I get # 28. A space is being added that 
I never asked for!

I've tried using strip-space, and normalize-space but niether of them worked.

The interesting thing is that when I wrap the # within a fo:inline, I don;t get 
the space but then I don't get the wrapping either.

Here's my code.

[code]

<xsl:if test="RC[.!=''] and RCOVERRIDE[.!='Y']">
  <xsl:if test="RCMODIFIED[.='Y']">#
  </xsl:if>
  <xsl:value-of select="RC"/>
  <fo:inline font-size="4pt">&#160;</fo:inline>
</xsl:if>

[code]

Thanks,
Rita


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: White Space Added but Not Needed

Posted by Rita Greenberg <rg...@medata.com>.
 Thanks Thomas.
I tried that and the space disappeared but the wrapping was gone also!




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: White Space Added but Not Needed

Posted by Pascal Sancho <ps...@gmail.com>.
Hi,

If you get a space between # and 28, this is because it is added
during XSLT stage, probably because of linefeeds or spaces around text
nodes.
Strictly speaking, this is out of topic in this list.
That said, if you want to avoid such unexpected spaces in XSL-FO
output, you have to embed all your text nodes in a xslt construction:
<fo:block>
<xsl:text>some text</xsl:text>
<xsl:value-of select="my/xpath/selector/or/my/xsl/expression"/>
<!-- etc -->
</fo:block>

You have to check by yourself that the produced XSL-FO gives text
nodes without unwanted spaces:
<fo:block>some textresult_of_value-of_evaluation</fo:block>

2012/6/25 Rita Greenberg <rg...@medata.com>:
> Thanks Pascal - I tried that but am still getting a space between the # and 28.
> I need #28.


-- 
pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: White Space Added but Not Needed

Posted by "Amick, Eric" <Er...@mail.house.gov>.
What happens when you use the following?


<xsl:if test="RC[.!=''] and RCOVERRIDE[.!='Y']">
  <xsl:if test="RCMODIFIED[.='Y']"><xsl:text>#</xsl:text>
  </xsl:if>
  <xsl:value-of select="RC"/>
  <fo:inline font-size="4pt">&#160;</fo:inline>
</xsl:if>

Eric Amick   Systems Engineer II
Legislative Computer Systems

> -----Original Message-----
> From: Rita Greenberg [mailto:rgreenberg@medata.com]
> Sent: Monday, June 25, 2012 17:50
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: White Space Added but Not Needed
> 
> Thanks Pascal - I tried that but am still getting a space between the #
> and 28.
> I need #28.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: White Space Added but Not Needed

Posted by Rita Greenberg <rg...@medata.com>.
Thanks Pascal - I tried that but am still getting a space between the # and 28.
I need #28.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: White Space Added but Not Needed

Posted by Pascal Sancho <ps...@gmail.com>.
Hi

2012/6/22 Rita Greenberg <rg...@medata.com>:
> Oops - I thought it worked but no - it's not!

> In my xsl:fo stylesheet I'm using wrap-option="wrap" on a fo:cell level.
FOP has limited support for wrap-option: only for fo:block. See
Compliance page at [1].

That said, FOP breaking algorithm needs a break opportunity to insert
a break line.
If you want a such opportunity between 2 characters that usually
remain stuck, you have to insert a ZWSP (&#x200b;) between them, like
that:
#&#x200b;28

[1] http://xmlgraphics.apache.org/fop/compliance.html#fo-property-wrap-option

-- 
pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: White Space Added but Not Needed

Posted by Rita Greenberg <rg...@medata.com>.
Oops - I thought it worked but no - it's not!


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: White Space Added but Not Needed

Posted by Rita Greenberg <rg...@medata.com>.
Thanks Thomas!
This time I got it to work correctly.

I used:
[code]
<xsl:if test="RC[.!=''] and RCOVERRIDE[.!='Y']" and RCMODIFIED[.='Y']">
  <xsl:variable name="aHash">#</xsl:variable>
  <xsl:value-of select="concat($aHash, RC)" />
  <fo:inline font-size="4pt">&#160;</fo:inline>
</xsl:if>

Much appreciated!


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: White Space Added but Not Needed

Posted by Thomas Morrison <Th...@microfocus.com>.
Hit send too early.

If you create a variable which contains the #, then you can use concat and normalize-space to create the string you want.

<xsl:variable name="aHash"><xsl:if test="RC[.!=''] and RCOVERRIDE[.!='Y']">
  <xsl:if test="RCMODIFIED[.='Y']">#</xsl:if>
</xsl:if>
</xsl:variable>

Then in the code:

<xsl:value-of select="concat(normalize-space($aHash),normalize-space(RC))"/>

(Typed, not tested...)

Best regards,
Tom Morrison
Senior Manager, Systems Software Projects
 
Micro Focus
Thomas.Morrison@microfocus.com
8310 N Capital of Texas Hwy
Building 2, Suite 100
Austin, TX 78731
USA
 
ShoreTel: 27018
Direct: +1.512.340.4822
Mobile: +1.512.785.9347


-----Original Message-----
From: Thomas Morrison [mailto:Thomas.Morrison@microfocus.com] 
Sent: Friday, June 22, 2012 2:13 PM
To: fop-users@xmlgraphics.apache.org
Subject: RE: White Space Added but Not Needed

Rita,

There are a couple of different techniques you can use better to control the whitespace.

First, you could use an <xsl:choose> which would allow you to construct an if-then-else so you can specify completely either a "28" or #28 without dealing with the whitespace problem.

Second, the concat() function in this situation might very well be a good friend, when used with normalize-space.

Con
Best regards,
Tom Morrison
Senior Manager, Systems Software Projects
 
Micro Focus

-----Original Message-----
From: Rita Greenberg [mailto:rgreenberg@medata.com] 
Sent: Friday, June 22, 2012 12:57 PM
To: fop-users@xmlgraphics.apache.org
Subject: White Space Added but Not Needed

Hello.

In my xsl:fo stylesheet I'm using wrap-option="wrap" on a fo:cell level.
I'm printing a hash (#) sign before an xml element if a cetain condition is met.

So, my element has, for example, a value of "28" and if the condition is met I want to print #28. The problem is that I get # 28. A space is being added that I never asked for!

I've tried using strip-space, and normalize-space but niether of them worked.

The interesting thing is that when I wrap the # within a fo:inline, I don;t get the space but then I don't get the wrapping either.

Here's my code.

[code]

<xsl:if test="RC[.!=''] and RCOVERRIDE[.!='Y']">
  <xsl:if test="RCMODIFIED[.='Y']">#
  </xsl:if>
  <xsl:value-of select="RC"/>
  <fo:inline font-size="4pt">&#160;</fo:inline>
</xsl:if>

[code]

Thanks,
Rita


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


This message has been scanned by MailController - portal1.mailcontroller.co.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: White Space Added but Not Needed

Posted by Thomas Morrison <Th...@microfocus.com>.
Rita,

There are a couple of different techniques you can use better to control the whitespace.

First, you could use an <xsl:choose> which would allow you to construct an if-then-else so you can specify completely either a "28" or #28 without dealing with the whitespace problem.

Second, the concat() function in this situation might very well be a good friend, when used with normalize-space.

Con
Best regards,
Tom Morrison
Senior Manager, Systems Software Projects
 
Micro Focus

-----Original Message-----
From: Rita Greenberg [mailto:rgreenberg@medata.com] 
Sent: Friday, June 22, 2012 12:57 PM
To: fop-users@xmlgraphics.apache.org
Subject: White Space Added but Not Needed

Hello.

In my xsl:fo stylesheet I'm using wrap-option="wrap" on a fo:cell level.
I'm printing a hash (#) sign before an xml element if a cetain condition is met.

So, my element has, for example, a value of "28" and if the condition is met I want to print #28. The problem is that I get # 28. A space is being added that I never asked for!

I've tried using strip-space, and normalize-space but niether of them worked.

The interesting thing is that when I wrap the # within a fo:inline, I don;t get the space but then I don't get the wrapping either.

Here's my code.

[code]

<xsl:if test="RC[.!=''] and RCOVERRIDE[.!='Y']">
  <xsl:if test="RCMODIFIED[.='Y']">#
  </xsl:if>
  <xsl:value-of select="RC"/>
  <fo:inline font-size="4pt">&#160;</fo:inline>
</xsl:if>

[code]

Thanks,
Rita


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


This message has been scanned by MailController - portal1.mailcontroller.co.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: White Space Added but Not Needed

Posted by Rita Greenberg <rg...@medata.com>.
Amick, Eric <Eric.Amick <at> mail.house.gov> writes:

> 
> But you *do* ask for whitespace-the newline after the # sign and the spaces 
at the start of the following line
> do that. Use <xsl:text>#</xsl:text> instead.
> 
> Eric Amick   Systems Engineer II
> Legislative Computer Systems
> 

Thanks Eric for your quick response.
I tried <xsl:text> and that removed the white space - however I lost my 
wrapping! The cell's contents overflowed with the prior cell.




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: White Space Added but Not Needed

Posted by "Amick, Eric" <Er...@mail.house.gov>.
But you *do* ask for whitespace-the newline after the # sign and the spaces at the start of the following line do that. Use <xsl:text>#</xsl:text> instead.

Eric Amick   Systems Engineer II
Legislative Computer Systems

> -----Original Message-----
> From: Rita Greenberg [mailto:rgreenberg@medata.com]
> Sent: Friday, June 22, 2012 13:57
> To: fop-users@xmlgraphics.apache.org
> Subject: White Space Added but Not Needed
> 
> Hello.
> 
> In my xsl:fo stylesheet I'm using wrap-option="wrap" on a fo:cell
> level.
> I'm printing a hash (#) sign before an xml element if a cetain
> condition is met.
> 
> So, my element has, for example, a value of "28" and if the condition
> is met I
> want to print #28. The problem is that I get # 28. A space is being
> added that
> I never asked for!
> 
> I've tried using strip-space, and normalize-space but niether of them
> worked.
> 
> The interesting thing is that when I wrap the # within a fo:inline, I
> don;t get
> the space but then I don't get the wrapping either.
> 
> Here's my code.
> 
> [code]
> 
> <xsl:if test="RC[.!=''] and RCOVERRIDE[.!='Y']">
>   <xsl:if test="RCMODIFIED[.='Y']">#
>   </xsl:if>
>   <xsl:value-of select="RC"/>
>   <fo:inline font-size="4pt">&#160;</fo:inline>
> </xsl:if>
> 
> [code]
> 
> Thanks,
> Rita
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: White Space Added but Not Needed

Posted by Rita Greenberg <rg...@medata.com>.
Glenn Adams <glenn <at> skynav.com> writes:

> 
> 
> this is a problem with your XSL style sheet, not with FOP processing; you 
should review the XSL-FO output from the XSLT process to see what the real 
input to FOP is
> 
> 
Thanks Glen. I need to figure out how to review the XSL-FO output.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: White Space Added but Not Needed

Posted by Glenn Adams <gl...@skynav.com>.
this is a problem with your XSL style sheet, not with FOP processing; you
should review the XSL-FO output from the XSLT process to see what the real
input to FOP is


On Fri, Jun 22, 2012 at 11:57 AM, Rita Greenberg <rg...@medata.com>wrote:

> Hello.
>
> In my xsl:fo stylesheet I'm using wrap-option="wrap" on a fo:cell level.
> I'm printing a hash (#) sign before an xml element if a cetain condition
> is met.
>
> So, my element has, for example, a value of "28" and if the condition is
> met I
> want to print #28. The problem is that I get # 28. A space is being added
> that
> I never asked for!
>
> I've tried using strip-space, and normalize-space but niether of them
> worked.
>
> The interesting thing is that when I wrap the # within a fo:inline, I
> don;t get
> the space but then I don't get the wrapping either.
>
> Here's my code.
>
> [code]
>
> <xsl:if test="RC[.!=''] and RCOVERRIDE[.!='Y']">
>  <xsl:if test="RCMODIFIED[.='Y']">#
>  </xsl:if>
>  <xsl:value-of select="RC"/>
>  <fo:inline font-size="4pt">&#160;</fo:inline>
> </xsl:if>
>
> [code]
>
> Thanks,
> Rita
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>