Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 27th, 2012, 01:49 PM
Authorized User
Points: 231, Level: 4
Points: 231, Level: 4 Points: 231, Level: 4 Points: 231, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 44
Thanks: 6
Thanked 0 Times in 0 Posts
Default Why Is a Recursive Loop Printing an Extra Space

Hello.

I'm printing a LastName which has a maximum of 18 characters.
In Position 21 (starting position 1 from first character of Lastname) I need to print an ID number.

So, if LastName is Sotherland and my ID number is 1234, on the printed line I would have (starting in position 1): Sotherland 1234 (with 10 spaces after Sotherland).

I have the following code but it's adding an extra space after the space value. I know this as I replaced the space value with R and my result was
Sotherland R R R R R R R R R R 1234.

Here's my code.
How can I get rid of the extra space each time the template is called?

Template Calling Block.
Code:
                        <fo:block>
                          <xsl:value-of select="EOB/PROVIDER/NUMBER"/>
                          <xsl:variable name="strLength" select="19 - string-length(EOB/PROVIDER/NUMBER)"/>
                          <xsl:if test="EOB/PROVIDER/EXTERNALID[.!='']">
                            <xsl:call-template name="addSpaces">
                              <xsl:with-param name="count">
                                <xsl:value-of select ="$strLength"/>
                              </xsl:with-param> 
                            </xsl:call-template>
                            <xsl:value-of select="EOB/PROVIDER/EXTERNALID"/> 
                          </xsl:if>
                        </fo:block>
Template Code
Code:
  </xsl:template>
  <xsl:template name="addSpaces">
    <xsl:param name="count"/>
      & # 1 6 0 ;
    <xsl:if test="$count>0">
      <xsl:call-template name="addSpaces">
        <xsl:with-param name="count" select="($count)-1"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
NOTE: I'm using "& # 1 6 0 ;" with spaces in between just to show you the value I'm using for a space as it shows up as a space on that line if I don't.

Thanks,
Rita
Reply With Quote
  #2 (permalink)  
Old March 27th, 2012, 02:01 PM
Authorized User
Points: 231, Level: 4
Points: 231, Level: 4 Points: 231, Level: 4 Points: 231, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 44
Thanks: 6
Thanked 0 Times in 0 Posts
Default Why Is a Recursive Loop Printing an Extra Space

Hmm.
I tried adding the space value to a <fo:inline> and that did the trick.
The space between the <fo:inline> actually holds "& #160;" (without the spaces between & and #).
Code:
<fo:inline> </fo:inline>
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash animation created extra space on web page itHighway Flash (all versions) 0 May 22nd, 2009 05:54 AM
How to remove extra space from PSV dved XSLT 2 February 18th, 2009 09:52 AM
extra space??? crazeydazey XSLT 2 August 11th, 2008 05:55 AM
nested <div> creates extra space sstuber BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 May 2nd, 2008 09:56 AM
Stripping out extra space around an italic word simone_s XSLT 2 April 25th, 2006 03:50 AM



All times are GMT -4. The time now is 06:27 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.