Jump to content

Need Help With Formatting Decimal Amounts


oracan

Recommended Posts

Hi, I'm new to xsl and am trying to line up decimal amounts so that they appear as right-justified on a document. Currently I can only get them to be left justified. The document has a reference-orientation = "90", so adjusting the positioning of the amounts is done using the format top. I've tried putting the code dealing with the amounts within an xsl table but that had no effect. I've tried using the format bottom instead of top, thinking the amounts would justify from the bottom instead of the top but that didn't work either. Interestingly the only values that work in the text-align statement are near, far and center. Right, left, start, end and justify give errors stating they are not defined. However, none of the text-align values I use ie. near, far and center have any effect on the justification of the amounts. Any help for this question is appreciated. Please let me know if additional information is needed. Thanks! Here is the portion of the xml that contains the amount data: <Details><DetailCharges><ChargeCategoryID>38</ChargeCategoryID><ChargeCategoryParentID>2</ChargeCategoryParentID><ChAmount>110.00</ChAmount><ChCodeChild>S Usage</ChCodeChild><ChDescChild>S Usage</ChDescChild><ChCode /><ChDescription /><BudgetAmount></BudgetAmount></DetailCharges><DetailCharges><ChargeCategoryID>85</ChargeCategoryID><ChargeCategoryParentID>2</ChargeCategoryParentID><ChAmount>5.89</ChAmount><ChCodeChild>S RTS</ChCodeChild><ChDescChild>S RTS</ChDescChild><ChCode /><ChDescription /><BudgetAmount></BudgetAmount></DetailCharges><DetailCharges><ChargeCategoryID>79</ChargeCategoryID><ChargeCategoryParentID>1</ChargeCategoryParentID><ChAmount>12.50</ChAmount><ChCodeChild>W Usage</ChCodeChild><ChDescChild>W Usage</ChDescChild><ChCode /><ChDescription /><BudgetAmount></BudgetAmount></DetailCharges><DetailCharges><ChargeCategoryID>111</ChargeCategoryID><ChargeCategoryParentID>1</ChargeCategoryParentID><ChAmount>4.83</ChAmount><ChCodeChild>RTS</ChCodeChild><ChDescChild>RTS</ChDescChild><ChCode /><ChDescription /><BudgetAmount></BudgetAmount></DetailCharges></Details> Here is some info about the xsl we are using. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:msxsl="urn:schemas-microsoft-com:xslt"xmlns:fo="http://www.w3.org/1999/XSL/Format"version="1.0" Here is the code which handles the placing of the description and amounts on the document.<!--Detail Charges Name Description--> <xsl:template match="Details"><xsl:param name="Left" select="Left"/><xsl:param name="Top" select="Top"/><xsl:param name="TopAddtwo" select="TopAddtwo"/><xsl:for-each select="DetailCharges" ><block-container reference-orientation="90"left="{$Left -( (position()*.1)+($TopAddtwo +.05 ))}in"top="{$Top}in"right="2.5in"absolute-position='absolute'><block ><xsl:value-of select="ChDescChild"/></block></block-container>   <!--Detail Charges Amount--> <block-container reference-orientation="90"left="{$Left -( (position()*.1)+($TopAddtwo +.05 ))}in"top="{$Top +2.6}in" absolute-position='absolute'><block text-align="far"><xsl:value-of select="ChAmount"/></block></block-container></xsl:for-each><xsl:apply-templates select="../Details/DetailConsumptions"><xsl:with-param name="Left" select=" $Left +.75"/><xsl:with-param name="Top" select="$Top "/><xsl:with-param name="NextRow"><xsl:value-of select="$TopAddtwo + nws:ReturnCountOfDetailCharges()"/></xsl:with-param></xsl:apply-templates></xsl:template>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...