xsl-list
[Top] [All Lists]

RE: [xsl] XSL Variable not getting set

2007-03-14 08:44:44

<xsl:for-each select="1 to 12">
             <xsl:variable name="p" select="."/>
             <xsl:value-of select="if ($cg[(_at_)month=$p]) then 
$cg[(_at_)month=$p]/@cost else 0"/>
             <xsl:if
test="position()!=last()">,</xsl:if>
           </xsl:for-each>


I had no idea you could loop that way with XSL. 

You can make it even tighter if you like:

<xsl:value-of 
  select="for $p in 1 to 12 return ($cg[(_at_)month=$p]/@cost, 0)[1]"
  separator=","/>

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--