[xsl] RE: Correction

Subject: [xsl] RE: Correction
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Tue, 17 May 2005 12:02:40 +0000
Oleg,

A little comment to that portion of your code:
 <xsl:template name="trimmed-data">
       <!-- pos of first non-zero rebate1 -->
       <xsl:variable name="pr1"
select="count(mystruct/myarray1/myvar/rebate1[. &lt;= 0]) + 1"/>

1) I don't quite get what you are calculating here, what does [. <= 0]
mean, that current node <= 0 ?

Yes--roughly, text-value of current node <= 0. Thus if we have the following sequence:


0 0 1 2 3 4 ...

The first non-zer0 number is at position 3 (XSL is 1-based), which is count(nodes-lte-0) + 1

2) It looks to me that any non-numeric nodes like <blank>, 'NaN', 'N/A', 'abc'
will break the algorithm. How can we make it a bit more robust ?


Non-numbers (in XSLT 1.0) should be OK. At the moment I can't elaborate precisely why since I'm pretty new at this myself, and haven't yet done enough reading-up on specs or semantics. Please try out by adding nodes tothe snippet I posted.


Regards,


--A

_________________________________________________________________
Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/


Current Thread