RE: [xsl] Dynamically creating XPath expressions Help required

Subject: RE: [xsl] Dynamically creating XPath expressions Help required
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Fri, 2 Apr 2004 06:33:04 +0300
Hi,

> <xsl:for-each select="Reports/GridBody0">
> 
>      <xsl:if test="Col3 != ''" > 

Though correct, it's preferable to use

  not(Col3 = '')

or

  not(string-length(Col3) = 0)

> 	<xsl:variable name="rowNo" 
> select="concat('../GridColors/Grid0RowNo',RowNo,'Col3LimeGreen
> ')"></xsl:variable> 

change this to 

  <xsl:variable name="rowNo" select="concat('Grid0Row',RowNo,'Col3LimeGreen')"/>

(also note that you had a typo, the source element name starts with 'Grid0Row', not 'Grid0RowNo'.)

> 	     <xsl:choose>
> 	       <!--If this element exist and we have to render green-->
> 		     <xsl:when test="$rowNo = 1" >-->

and this to

  <xsl:when test="../GridColors/*[name() = $rowNo] = 1" >

Cheers,

Jarno - RantRadio Industrial: Industrial Electronica for Your Mind

Current Thread