[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Dynamically creating XPath expressions Help required

Subject: Dynamically creating XPath expressions Help required
From: <cheburashka@xxxxxxxxxx>
Date: Fri, 2 Apr 2004 14:15:23 +1200
cheburashka
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"%>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.