[xsl] Please help Problem for : increment a variable in a for-each?

Subject: [xsl] Please help Problem for : increment a variable in a for-each?
From: que Li <queincanada@xxxxxxxx>
Date: Tue, 30 Nov 2004 13:28:49 -0500 (EST)
Hi all:
  I got so many peopel help but I can't get solution
for my problem yet. I need fix it asap so please help
me ! question is : How I can find relatiove position 
on the node which satify the condition ? I try to set
the variable called index and increment index value
when I call template but the index value is always 1

I work on this problems for several days, I wish I can
get help for solution.


xml file:
<List >
<List >
 <List >
 <List >

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; >

<xsl:template match="Lists"  >
<xsl:with-param name="ValidCount"

<xsl:template match="List">
   <xsl:param name="ValidCount"/>
   <xsl:variable name="self" select="."/> 
   <xsl:variable name="index" select="0"/> 
   <xsl:when test="Parent_ID=1 or
not(preceding-sibling::List[List_ID = $self/Parent_ID]
 or following-sibling::List[List_ID =
 <xsl:call-template name="formatTitle">
  <xsl:with-param name="index" select="$index+1"/>
  <xsl:with-param name="TotalCount"
<xsl:with-param name="Title" select="Title"/>         
<xsl:call-template name="findChildNode">
  <xsl:with-param name="ParentID" select="List_ID"/>

<xsl:template name="findChildNode">
....this part work

<xsl:template name="formatTitle">
 	   <xsl:param  name="index" />
                  <xsl:param  name="TotalCount"/> 
               index:  <xsl:value-of select="$index"/>
                  <xsl:param name="Title"/>	
<xsl:when test="$TotalCount=1 or $index=1">
 <b><xsl:value-of select="$Title"/></b>						
						<xsl:when test="$index = $TotalCount -1">
						     <b> and <xsl:value-of select="$Title"/></b>
						<xsl:when test="$index  = $TotalCount">
						     <b> <xsl:value-of select="$Title"/></b>				
						   <b>; <xsl:value-of select="$Title"/></b>	

Post your free ad now! http://personals.yahoo.ca

Current Thread