[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] complex alternative row coloring problem
Subject: [xsl] complex alternative row coloring problem From: thea@xxxxxxxxxx Date: Tue, 7 Oct 2003 01:24:46 -0600 (MDT) |
hello, i have a somewhat complex alternative row coloring problem. below is the data that I want to be able to be displayed account 112222 kkkk kkkkk kkkkk 244555 llll iudif reere deposit d3434 erer erter 34343 total 33333 credit 333333 33333 5tttt eerere brokerage dfadfad eeee eeee eeeeee the xml structure is roughly as follows: <table> <record> <asset_name>Konto</asset_name> <asset_value>blahblabhablahb</asset_value> <asset_value_c_curr>36004.7</asset_value_c_curr> <asset_curr_exchange_rate></asset_curr_exchange_rate> <asset_percent_of_total_value>34.78</asset_percent_of_total_value> <asset_children> <table> <record> <asset_name>87598.46</asset_name> </record> <record> <asset_name>87598.80</asset_name> </record> </table> </asset_children> </record> <record> <asset_name>Depot</asset_name> <asset_value>blahblabhablahb</asset_value> <asset_value_c_curr>36304.7</asset_value_c_curr> <asset_curr_exchange_rate></asset_curr_exchange_rate> <asset_percent_of_total_value>42.78</asset_percent_of_total_value> <asset_children> <table> <record> <asset_name>14572.46</asset_name> </record> <record> <asset_name>75918.80</asset_name> </record> </table> </asset_children> </record> <record> <asset_name>Festgeld</asset_name> <asset_value>blahblabhablahb</asset_value> <asset_value_c_curr>4502.7</asset_value_c_curr> <asset_curr_exchange_rate></asset_curr_exchange_rate> <asset_percent_of_total_value>489.78</asset_percent_of_total_value> <asset_children> <table> <overflowed>false</overflowed> <maxrows>-1</maxrows> <record> <asset_name>12345.46</asset_name> </record> <record> <asset_name>78945.80</asset_name> </record> </table> </asset_children> </record> </table> I have been able to create alternative row colorings however, in some positions the color is repeated and i have been working on this problem for a while and thought that someone out there could offer some light on the problem. I am getting somewhat fustrated. Below is my code: <xsl:template name="productViewTable"> <fo:table border-collapse="separate" table-layout="fixed" > <fo:table-column column-number="1" column-width="25mm"/> <fo:table-column column-number="2" column-width="40mm"/> <fo:table-column column-number="3" column-width="30mm"/> <fo:table-column column-number="4" column-width="15mm"/> <fo:table-column column-number="5" column-width="20mm"/> <fo:table-column column-number="6" column-width="20mm"/> <fo:table-column column-number="7" column-width="20mm"/> <!-- table header--> <xsl:call-template name="accountTrxTableHeader"> <xsl:with-param name="product-type" select="asset_name"/> </xsl:call-template> <fo:table-body table-layout="fixed"> <xsl:apply-templates select="$mainPath/getproductview/document/content/map/fort_asset_list/table/record"> <xsl:with-param name="productType" select="asset_name"/> </xsl:apply-templates> </fo:table-body> </fo:table> </xsl:template> <xsl:template match="table/record"> <fo:table-row space-after.optimum="10pt" font-weight="normal" font-family="Helvetica" font-size="9pt"> <xsl:choose> <xsl:when test="position() mod 2 = 0"> <xsl:attribute name="background-color">#e3e3e3 </xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="background-color">#FFFFFF</xsl:attribute> </xsl:otherwise> </xsl:choose> <fo:table-cell number-columns-spanned="7" text-align="left"> <fo:block font-family="Helvetica" font-weight="bold" font-size="8pt"> <xsl:value-of select="asset_name"/> </fo:block> </fo:table-cell> </fo:table-row> <xsl:for-each select="asset_children/table/record"> <fo:table-row> <xsl:choose> <xsl:when test="position() mod 2 != 0"> <xsl:attribute name="background-color">#e3e3e3</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="background-color">#FFFFFF</xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:call-template name="assetOverview"> <xsl:with-param name="Type" select="asset_children/table/record/asset_type_cd"/> </xsl:call-template> </fo:table-row> </xsl:for-each> <xsl:if test="(position() = 2 or ($number-of-all-records = 1)"> <fo:table-row> <xsl:choose> <xsl:when test="position() mod 2 != 0"> <xsl:attribute name="background-color">#e3e3e3</xsl:attribute> </xsl:when> <xsl:when test="preceding-sibling"/> <xsl:otherwise> <xsl:attribute name="background-color">#FFFFFF</xsl:attribute> </xsl:otherwise> </xsl:choose> <xsl:call-template name="showBalanceInfo"/> </fo:table-row> </xsl:if> </xsl:template> <xsl:template name="assetOverview"> <xsl:param name="Type"/> <fo:table-cell text-align="left"> <fo:block> <xsl:value-of select="asset_name"/> </fo:block> </fo:table-cell> <fo:table-cell text-align="left"> <fo:block> <xsl:value-of select="asset_type"/> </fo:block> </fo:table-cell> <fo:table-cell text-align="left"> <fo:block> <xsl:value-of select="asset_value_date"/> </fo:block> </fo:table-cell> <fo:table-cell text-align="left"> <fo:block> <xsl:value-of select="asset_value_curr_mnemonic"/> </fo:block> </fo:table-cell> <fo:table-cell text-align="right"> <fo:block> <xsl:value-of select='format-number(asset_value, "#'##0.00", "de-ch")'/> </fo:block> </fo:table-cell> <fo:table-cell text-align="right"> <fo:block> <xsl:call-template name="formatExchangeRateFI"> <xsl:with-param name="value" select="asset_curr_exchange_rate"/> </xsl:call-template> </fo:block> </fo:table-cell> <fo:table-cell text-align="right"> <fo:block> <xsl:value-of select='format-number(asset_value_c_curr, "#'##0.00", "de-ch")'/> </fo:block> </fo:table-cell> <!-- <fo:table-cell text-align="right"> <fo:block> <xsl:call-template name="formatPercent"> <xsl:with-param name="value" select="asset_percent_of_total_value"/> </xsl:call-template> </fo:block> </fo:table-cell> --> </xsl:template> <xsl:template name="showBalanceInfo"> <fo:table-cell text-align="left" number-columns-spanned="6"> <fo:block space-after.optimum="10pt" space-before.optimum="10pt" font-family="Helvetica" font-weight="bold" font-size="8pt"> <xsl:value-of select="/document/content/map/properties/getProductView/Language/*[name()=$lang]/Form/BalanceDate"/> </fo:block> </fo:table-cell> <fo:table-cell text-align="right"> <fo:block space-after.optimum="10pt" space-before.optimum="10pt" font-family="Helvetica" font-weight="bold" font-size="8pt"> <xsl:value-of select='format-number($mainPath/getproductview/document/content/map/fort_total_value_c_curr, "#'##0.00", "de-ch")'/> </fo:block> </fo:table-cell> </xsl:template> If the problem is clear. Kind regards T. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XML Application Object for PH, Terence Kearns | Thread | [xsl] xsl: selecting and copying no, james walker |
[xsl] Re: XPath 2.0: Problems with , Dimitre Novatchev | Date | RE: [xsl] Good Subject Lines, Jim Fuller |
Month |
Keywords