Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] Dynamically creating XPath expressions Help required

From: <cheburashka@---------->
To:
Date: 4/1/2004 4:16:00 PM
Hi my name is adam, I got your email address from the google search. I hpoe you do not mind me contacting you directly.But I need help with some xslt.

I am constructing a table, Each GridBody0 - GridBody n
node set represents a single row of the table.Each Gridbody tag included a number of Col0 - Col n tags
these represent each cell of the row.

The problem is that each cell that is rendered must be conditionally formatted.Tags that need to be formatted are
include within the gridcolors section of the xml document.

  <Grid0Row0Col3LimeGreen>1</Grid0Row0Col3LimeGreen>

 The idea is to use a for-each loop to go through each
 set of gridbody tags to render them. As I do this I
want to construct a path query to determine if the current cell is turned green 

 <Grid0Row0Col3LimeGreen> if this exist then green. 


The question is how


xslt

<xsl:for-each select="Reports/GridBody0">

     <xsl:if test="Col3 != ''" > 
	<xsl:variable name="rowNo" select="concat('../GridColors/Grid0RowNo',RowNo,'Col3LimeGreen')"></xsl:variable> 
	     <xsl:choose>
	       <!--If this element exist and we have to render green-->
		     <xsl:when test="$rowNo = 1" >-->
		                               
		        <td align="right" width="60"  bordercolor="DarkGray" border="1" bgcolor="LimeGreen">
			   <font style='FONT-WEIGHT: normal;Font-Size:XX-Small; COLOR: Black; FONT-FAMILY:Verdana'>      
										
			       <xsl:value-of select="format-number(Col3,'#,##0.#')"></xsl:value-of>
			   </font>
			</td>       
		       </xsl:when>

                      <!--etc-->
 </xsl:for-each>
 

Xml

<Reports>
 <GridColors>
    <Grid0Row0Col3LimeGreen>1</Grid0Row0Col3LimeGreen>
    <Grid0Row1Col3LimeGreen>1</Grid0Row1Col3LimeGreen> 
</GridColors>
   <GridBody0>
    <MemberUniqueName>[Product].[All Products].[Consumer  Electronics]</MemberUniqueName>
    <MemberCaption>Consumer Electronics</MemberCaption>
    <RowNo>0</RowNo>
    <Col0>13458.26555</Col0>
    <Col1>9952.06343</Col1>
    <Col2>14633.765640000001</Col2>
    <Col3>35.230906079544546</Col3>
    <Col4>-8.032792918227992</Col4>
  </GridBody0>
 <GridBody0>
    <MemberUniqueName>[Product].[All Products].[Domestic Whiteware]</MemberUniqueName>
    <MemberCaption>Domestic Whiteware</MemberCaption>
    <RowNo>1</RowNo>
    <Col0>2983.95073</Col0>
    <Col1>2632.35801</Col1>
    <Col2>3400.7199100000003</Col2>
    <Col3>13.356569230490049</Col3>
    <Col4>-12.25532213854096</Col4>
  </GridBody0>
</Reports>


<%@ OutputCache Duration="60" VaryByParam="none"%>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent