Subject: RE: variable incrementing problems From: Kay Michael <Michael.Kay@xxxxxxx> Date: Mon, 28 Jun 1999 13:30:29 +0100 |
You cannot use xsl:variable to assign a new value to an existing variable: what your code is doing is to create a new variable of the same name, and when this goes out of scope (at </xsl:if>) your code picks up the earlier variable in preference. Instead of: <xsl:variable name="FolderRowspan"> <xsl:value-of select="count(subfolder)*2+1"/> </xsl:variable> <xsl:if test="count(highligth)+count(subfolder/highligth) > 0"> <xsl:variable name="FolderRowspan"> <xsl:value-of select="$FolderRowspan+1"/></xsl:variable> </xsl:if> Try this: <xsl:variable name="FolderRowSpan1"> <xsl:choose> <xsl:when test="count(highligth)+count(subfolder/highligth) > 0"> 1</xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> <xsl:variable name="FolderRowspan"> <xsl:value-of select="count(subfolder)*2 + 1 + $FolderRowSpan1"/> </xsl:variable> Or you could exploit the convenient fact that number() converts false to 0 and true to 1 by writing: <xsl:variable name="FolderRowspan"> <xsl:value-of select="count(subfolder)*2 + 1 + number(count(highligth)+count(subfolder/highligth) > 0)"/> </xsl:variable> Mike Kay (Incidentally, the reason I didn't allow nested variables of the same name in SAXON was for implementation convenience, but I'm beginning to think it was a good idea, as it traps this kind of error. Comments anyone?). > -----Original Message----- > From: Eugeny Kuzakov [mailto:kev@xxxxxxxxx] > Sent: 28 June 1999 11:57 > To: xsl-list@xxxxxxxxxxxxxxxx > Subject: variable incrementing problems > > > hi* > > I am need correctly calculate rowspan attribute in result > html-document. > I am have problems with it. > > Question: > In debug2 comment value of FolderRowspan variable correctly > incrementes into need value. > But after exit from <xsl:if> tag it keep previous value. > What can I do? > Thanks. > > -- > Best wishes, Eugeny Kuzakov > Laboratory 321 ( Omsk, Russia ) > kev@xxxxxxxxx > ICQ#: 5885106 > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
variable incrementing problems, Eugeny Kuzakov | Thread | RE: variable incrementing problems, Eugeny Kuzakov |
variable incrementing problems, Eugeny Kuzakov | Date | Exit in XSLT: was jumps (gotos....), Smith, Brian BC |
Month |