Yes, definitely. I assumed because you hadn't done this already that the XML 
data was out of your hands. But yes, if you can make the XML a little more 
granular like you demonstrate then you don't need an extra template at all. 
Just put a <fo:leader/> between the label and the amount, and set the block's 
text-align-last to justify. So...
 
<fo:block white-space-collapse="false" linefeed-treatment="preserve" 
text-align-last="justify" > 
     <xsl:text>&#x0A;</xsl:text> 
     <xsl:value-of select="euro-tax-msg5"/> 
     <fo:leader/>
     <xsl:value-of select="euro-tax-msg5-amt"/> 
     <xsl:text>&#x0A;</xsl:text> 
     <xsl:value-of select="euro-tax-msg6"/> 
     <fo:leader/>
     <xsl:value-of select="euro-tax-msg6-amt"/> 
     <xsl:text>&#x0A;</xsl:text> 
</fo:block>
 

>>> "Steffanina, Jeff" <[EMAIL PROTECTED]> 8/25/2008 3:00 PM >>>
David,
I can't make that guarantee of the space you mentioned.  Can I make it more 
simple if I split the string into Description and Amount as follows (again, my 
goal is to align the descriptions and the decimal points):

<euro-tax-msg5>Quebec Native Seal Tax</euro-tax-msg5>
<euro-tax-msg5-amt>15.42</euro-tax-msg5-amt> 

<euro-tax-msg6>BIG UPPER CASE TAX INO</euro-tax-msg6>
euro-tax-msg6-amt>439.59</euro-tax-msg6-amt> 
-------------------------- 
Jeff 


From: David Gerdt [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 25, 2008 2:23 PM
To: [email protected] 
Subject: Re: 0.95 - Printing a string and aligning the decimal points

Assuming you can guarantee that there will always be at least two spaces 
between the text and the digits, could you do something like the following?
 
<fo:block white-space-collapse="false" linefeed-treatment="preserve" 
text-align-last="justify" > 
     <xsl:text>&#x0A;</xsl:text> 
     <xsl:call-template name="split">
          <xsl:with-param name="string" select="euro-tax-msg5" />
     </xsl:call-template>
     <xsl:text>&#x0A;</xsl:text> 
     <xsl:call-template name="split">
          <xsl:with-param name="string" select="euro-tax-msg6" />
     </xsl:call-template>
     <xsl:text>&#x0A;</xsl:text> 
</fo:block>
 
 
<xsl:template name="split">
     <xsl:param name="string" />
     <xsl:variable name="first" select="substring-before($string,'  ')" />
     <xsl:variable name="rest" select="substring-after($string,'  ')" />
     <xsl:value-of select="$first" /><fo:leader/><xsl:value-of select="$rest" />
</xsl:template>
 


>>> "Steffanina, Jeff" <[EMAIL PROTECTED]> 8/25/2008 1:07 PM >>>

Friends, 

Existing Code in my XML file (the decimal points are aligned when using Courier 
font): 
<euro-tax-msg5>Quebec Native Seal Tax                      
15.42</euro-tax-msg5> 
<euro-tax-msg6>BIG UPPER CASE TAX INO              439.59</euro-tax-msg6> 
-------------------------- 
My XSL that prints (using Arial font): 
<fo:block white-space-collapse="false" linefeed-treatment="preserve" 
text-align="start" > 
                 <xsl:text>&#x0A;</xsl:text> 
                <xsl:value-of select="./euro-tax-msg5"/> 
               <xsl:text>&#x0A;</xsl:text> 
                <xsl:value-of select="./euro-tax-msg6"/> 
                <xsl:text>&#x0A;</xsl:text> 
        </fo:block> 
----------------------------- 
My Result: 
    Thelkj lk laksjf lkasjd flkajs flkj    15.42 
    Wakadf wlkej salksdjf HHHH         349.54 

Without creating a table, is there a way to get the text to align left and the 
digits to align right? 
I thank you for any suggestions. 

Jeff

Reply via email to