Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] assigned variable value is changing

From: Martin Honnen <Martin.Honnen@---.-->
To: xsl-list@-----.------------.---
Date: 8/3/2009 11:17:00 AM
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:if
>>> test="contains(preceding-sibling::entry[1],@namest)">
>>>                                        <xsl:value-of select="$colc - 1 +
>>> number(substring-after(preceding-sibling::entry[1]/@nameend,'c')) -
>>> number(substring-after(preceding-sibling::entry[1]/@namest,'c'))"/>
>>>                                </xsl:if>
>>>                                <xsl:if
>>> test="not(contains(preceding-sibling::entry[1],@namest))">
>>>                                        <xsl:value-of select="$colc - 1"/>
>>>                                </xsl:if>
>>>                                <xsl:text>:</xsl:text>
>>>                                <xsl:value-of select="$rowc - 1"/>
>>>                        </xsl:attribute>

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
   number(substring-after(preceding-sibling::entry[1]/@nameend,'c'))
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
	http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
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@l...>
--~--



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent