• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 828
  • Last Modified:

How to properly align rows and columns thru XSLT on blackberry ?

I am trying to display some output ( from sql proc/ email out ) to blackberry. Output is formatted using XSLT. Output has rows and columns. Three columns are numaric, so when numbers vary in digits columns get mis-aligned ( using <xsl:value-of select="format-number(Report/Table3/TOT_MTD,'#####')" />) I have couple of nbsp. Is there a way thru XMLT I can spcify start/end postions or any other way so when digits width vary - spaces are reserved and column alignment sticks. With using <xsl:value-of select="format-number(Report/Table3/TOT_MTD,'000,000.00')" /> works but users do not like leading zeros. Any ideas!
0
ivan_belal
Asked:
ivan_belal
  • 3
  • 3
1 Solution
 
BigRatCommented:
I presume you are outputting the data in HTML? If so a simple ALIGN=RIGHT on the TD element should do it?
0
 
ivan_belalAuthor Commented:
Output is aligned when viewed in MS Outlook. Same email when viewd in a Blackberry table (rows/columns) does not stick in terms of alignment. I have right on TD. As mentioned I was ok with padding with leading zeros, but users did not like it. Help, thanks.
</td>
                  <td style="text-align:right;">
                        <xsl:value-of select="format-number(Report/Table5/TOT_YTD_MF,'#####', 'us')" />
                        <xsl:text disable-output-escaping="yes"></xsl:text>
                  </td>
0
 
BigRatCommented:
It might be that blackberry does not support full CSS style sheeting (style="text-align:right") but the old HTML style. It won't do any harm, just add align=right to the TD element and try that.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
ivan_belalAuthor Commented:
thank you. no luck. attached is my code for your review.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
	<head>
		<title> sales for <xsl:value-of select="Report/Table1/RPT_DATE"/></title>
	</head>
	<body>
		<p>
			<b>(Dly in 000's)</b>  
		<br/>
		<b>(MTD, YTD in mil's)</b>
		</p>
		<br/>
		<p>
			<b>All products sales</b></p>
	
		<table>
			<tr bgcolor="#AAAAAA">
		    	<td>
					<b>Act</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
				<td ALIGN="right">
					<b>Dly</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
				<td ALIGN="right">
					
					<b>MTD</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
				<td ALIGN="right">
					<b>YTD</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
			</tr>
 
			<xsl:apply-templates select="Report/Table2">
			</xsl:apply-templates>
		</table>
 
 
		<tr>
			<td>
				<b>Total</b>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
 
				<xsl:value-of select="format-number(Report/Table3/TOT_DLY,'#####', 'us')"/>
 
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
 
				<xsl:value-of select="format-number(Report/Table3/TOT_MTD,'#####', 'us')" />
 
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
 
				<xsl:value-of select="format-number(Report/Table3/TOT_YTD,'#####', 'us')" />
 
				<xsl:text disable-output-escaping="yes"></xsl:text>
			</td>
		</tr>
		<br/>
		<p>
			<b>MF sales</b>
		</p>
		<br/>
		<table>
			<tr bgcolor="#AAAAAA">
				<td>
					<b>Act</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
				<td ALIGN="right">
					<b>Dly</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
				<td ALIGN="right">
					<b>MTD</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
				<td ALIGN="right">
					<b>YTD</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
			</tr>
			<xsl:apply-templates select="Report/Table4">
			</xsl:apply-templates>
		</table>
 
 
		<tr>
			<td>
				<b>Total</b>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(Report/Table5/TOT_DLY_MF,'#####', 'us')" />
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(Report/Table5/TOT_MTD_MF,'#####', 'us')" />
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(Report/Table5/TOT_YTD_MF,'#####', 'us')" />
				<xsl:text disable-output-escaping="yes"></xsl:text>
			</td>
		</tr>
		<br/>
		<p>
			<b>SMA sales</b>
			<br/>
		</p>
		<table>
			<tr bgcolor="#AAAAAA">
				<td>
					<b>Act</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
				<td ALIGN="right">
					<b>Dly</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
				<td ALIGN="right">
					<b>MTD</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
				<td ALIGN="right">
					<b>YTD</b>
					<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
				</td>
			</tr>
			<xsl:apply-templates select="Report/Table6">
			</xsl:apply-templates>
		</table>
 
 
		<tr>
			<td>
				<b>Total</b>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(Report/Table7/TOT_DLY_SMA,'#####', 'us')" />
				<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(Report/Table7/TOT_MTD_SMA,'#####', 'us')" />
				<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(Report/Table7/TOT_YTD_SMA,'#####', 'us')" />
				<xsl:text disable-output-escaping="yes"></xsl:text>
			</td>
		</tr>
 
				
		
	</body>
	
</html>
</xsl:template>
	<xsl:decimal-format name="us" decimal-separator='.' grouping-separator=',' />
	
	<xsl:template match="Report/Table2">
		<tr>
			<xsl:if test="position() mod 2 = 0">
				<xsl:attribute name="bgcolor">#AAAAAA</xsl:attribute>
			</xsl:if>
			<xsl:if test="position() mod 2 = 1">
				<xsl:attribute name="bgcolor">#EEEEEE</xsl:attribute>
			</xsl:if>
 
			<td>
				<xsl:value-of select="F_NM"/>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
 
				<xsl:value-of select="format-number(DLY,'#####', 'us')"/>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
 
				<xsl:value-of select="format-number(MTD,'#####', 'us')"/>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
 
				<xsl:value-of select="format-number(YTD,'#####', 'us')"/>
				<xsl:text disable-output-escaping="yes"></xsl:text>
			</td>
 
		</tr>
	</xsl:template>
 
	<xsl:template match="Report/Table4">
		<tr>
			<xsl:if test="position() mod 2 = 0">
				<xsl:attribute name="bgcolor">#AAAAAA</xsl:attribute>
			</xsl:if>
			<xsl:if test="position() mod 2 = 1">
				<xsl:attribute name="bgcolor">#EEEEEE</xsl:attribute>
			</xsl:if>
 
			<td>
				<xsl:value-of select="F_NM"/>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(DLY_MF,'#####', 'us')"/>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(MTD_MF,'#####', 'us')"/>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(YTD_MF,'#####', 'us')"/>
				<xsl:text disable-output-escaping="yes"></xsl:text>
			</td>
 
		</tr>
	</xsl:template>
 
	<xsl:template match="Report/Table6">
		<tr>
			<xsl:if test="position() mod 2 = 0">
				<xsl:attribute name="bgcolor">#AAAAAA</xsl:attribute>
			</xsl:if>
			<xsl:if test="position() mod 2 = 1">
				<xsl:attribute name="bgcolor">#EEEEEE</xsl:attribute>
			</xsl:if>
 
			<td>
				<xsl:value-of select="F_NM"/>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(DLY_SMA,'#####', 'us')"/>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(MTD_SMA,'#####', 'us')"/>
				<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
			</td>
			<td ALIGN="right">
				<xsl:value-of select="format-number(YTD_SMA,'#####', 'us')"/>
				<xsl:text disable-output-escaping="yes"></xsl:text>
			</td>
 
		</tr>
		
	</xsl:template>
	
</xsl:stylesheet>
 
  

Open in new window

0
 
BigRatCommented:
Got any xml input for me to try (can send it as an e-mail attachment if it is sensitive - I'll delete it when were done)?
0
 
ivan_belalAuthor Commented:
Input comes out of a Sql proc. Do not have an XML, but you can visualize or even make a sample test XML yourself if works. Basically four columns. Three of them numaric. First column is text. Any help is appreciated.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now