xsl-list
[Top] [All Lists]

RE: Correction

2005-05-17 05:02:40
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

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


--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>