xsl-list
[Top] [All Lists]

RE: Profiling Number Ranges

2004-11-23 11:23:36
If I understand you correctly, you need a 'for' expression. Something like:

$x > max(for $i in tokenize($s, ';') return number($i))

Michael Kay
http://www.saxonica.com/



 

-----Original Message-----
From: Naomi Gronson [mailto:naomi_gronson(_at_)yahoo(_dot_)com] 
Sent: 23 November 2004 17:10
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Profiling Number Ranges

That tokenize function works great and I really like
what I see when browsing the Xpath functions.  I
upgraded to the latest saxon to get some of the 2.0
support and was able to get the code to this point.

I tokenize and loop through the SystemLevel attributes
(5.1;5.4;6.0) of elements that have it defined, then I
do a comparison to find if a given element meets the
greater than criteria.  It seems like I'm stuck at a
place where a variable would need to be set or
something because I can't figure out how to display
pass through the current node (context item/atomic
value), and how to do that only once (not for every
compare that meets the criteria).

$SystemLevel=5.1+

<xsl:when test="contains($SystemLevel, '+') and
@SystemLevel">
      <xsl:for-each select="tokenize(@SystemLevel, ';')">
              <xsl:if test="number(.) &gt;=
number(translate($SystemLevel, '+', ''))">    
                      <!-- if this loop entered I want to keep the
element -->
              </xsl:if>
      </xsl:for-each>
   </xsl:when> 

Then after looking at some of the other Xpath 2.0
functions, I thought maybe using the Max and Min
functions on my SystemLevel attributes to then do a
compare against the largest number of the group, but I
can't seem to figure out how to get my @SystemLevel
(5.1;5.4;6.0) in to a the proper format for
fn:max()...something like this:

<xsl:if test="number(max((translate(@SystemLevel, ';',
',')))) &gt;= number(translate($SystemLevel, '+',
''))">        
      <!-- if this loop entered I want to keep the element
-->
</xsl:if>

I appreciate all the help.

Naomi




              
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>