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 Anil <an...@sbcglobal.net> on 2004/01/27 22:47:53 UTC

Space After

Hi,
I am trying to use variables inside blocks as below

<fo:block >
	<xsl:if test="$City!=''">
	      <xsl:value-of select="normalize-space($City)"/>
	  <xsl:if test="$State!=''">
	     &#x2C;&#160;<xsl:value-of select="$State"/>
	  </xsl:if>
	  <xsl:if test="$Zip!=''">
            &#160;<xsl:value-of select="normalize-space($Zip)"/>
	  <xsl:if test="$ZipExt!=''">
	     -<xsl:value-of select="$ZipExt"/>
          </xsl:if>
	  </xsl:if>
        </xsl:if>	
</fo:block>

My expected output is City, State Zip-ZipExt

But i am getting City{space}, State Zip{Space}-ZipExt

Please let me know how to avoid the extra space after the variable.

Thanks
-AV




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


Re: Space After

Posted by Anil <an...@sbcglobal.net>.
It worked!!!
Thanks again Pietschmann. I really appreciate your help.




--- "J.Pietschmann" <j3...@yahoo.de> wrote:
> Anil wrote:
> > 	      <xsl:value-of select="normalize-space($City)"/>
> > 	  <xsl:if test="$State!=''">
> > 	     ,�<xsl:value-of select="$State"/>
> > 	  </xsl:if>
> ...
> > My expected output is City, State Zip-ZipExt
> > 
> > But i am getting City{space}, State Zip{Space}-ZipExt
> 
> The XSLT processor strips whitespace-only nodes from the
> stylesheet. Thie means any text nodes with any non-whitespace
> character is left as is, including *all* whitespace. Even
> whitespace at the end or beginning is *not* stripped. There
> is *no* whitespace normalization for these nodes.
> A non-breaking space is not a whitespace. THerefore you get
> the linefeed after the xsl:if opening tags as well as the
> spaces used for indentation into the output.
> 
> Either try to omit the whitespace you dont want:
>    <xsl:if test="$State!=''">,�<xsl:value-of select="$State"/>
> or enclose significant text in xsl:text:
>    <xsl:if test="$State!=''">
>       <xsl:text>,�</xsl:text>
>       <xsl:value-of select="$State"/>
> 
> J.Pietschmann
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
> 


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


Re: Space After

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Anil wrote:
> 	      <xsl:value-of select="normalize-space($City)"/>
> 	  <xsl:if test="$State!=''">
> 	     &#x2C;&#160;<xsl:value-of select="$State"/>
> 	  </xsl:if>
...
> My expected output is City, State Zip-ZipExt
> 
> But i am getting City{space}, State Zip{Space}-ZipExt

The XSLT processor strips whitespace-only nodes from the
stylesheet. Thie means any text nodes with any non-whitespace
character is left as is, including *all* whitespace. Even
whitespace at the end or beginning is *not* stripped. There
is *no* whitespace normalization for these nodes.
A non-breaking space is not a whitespace. THerefore you get
the linefeed after the xsl:if opening tags as well as the
spaces used for indentation into the output.

Either try to omit the whitespace you dont want:
   <xsl:if test="$State!=''">&#x2C;&#160;<xsl:value-of select="$State"/>
or enclose significant text in xsl:text:
   <xsl:if test="$State!=''">
      <xsl:text>&#x2C;&#160;</xsl:text>
      <xsl:value-of select="$State"/>

J.Pietschmann

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