Re: [xsl] assigned variable value is changing

Subject: Re: [xsl] assigned variable value is changing
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 03 Aug 2009 13:16:35 +0200
Ganesh Babu N wrote:

In the Name attribute i am capturing column number: row number.

Check the row[2]. In that we are having only 2 <entry>s instead of 3
because of the colspan.
So in my output i am increasing the column number of the 2nd <entry>
by the colspan value.

so for 2nd entry the value of @Name is 2:1

Up to here the code is working correctly. after that in the column
number i am getting NaN. Even though i have included test conditions.

That test is below:

                                       <xsl:value-of select="$colc - 1 +
number(substring-after(preceding-sibling::entry[1]/@nameend,'c')) -
                                       <xsl:value-of select="$colc - 1"/>
                               <xsl:value-of select="$rowc - 1"/>

The fourth 'entry' element looks like this:
<entry align="left" valign="top">Table 1 TH C1 R2</entry>

so @namest is an empty sequence and that way the check contains(preceding-sibling::entry[1],@namest) gives true as for the contains function the empty sequence is interpreted as an empty string and for the second argument being the empty string contains gives true.

So for that 'entry' the template tries to compute
which gives NaN as preceding-sibling::entry[1]/@nameend is the empty sequence, that way substring-after gives an empty string and number('') gives NaN. That way the whole expression gives NaN.


	Martin Honnen

Current Thread