[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Max of...

Subject: Re: Max of...
From: RSuiter@xxxxxxxxx
Date: Thu, 8 Mar 2001 13:13:42 -0600
xsl finding a maximum
Lindy Quick,

I composed this before I saw Goetz Beck's reply to your post, but I think
this is complementary to what he said, so I'm still going to send it

You wrote that you wanted to determine

   "for each the minimum and maximum value of each whole-request,
   sub-request,
   and another-request.

   I have tried to determine the Whole Request maximum, using
   xsl:call-template
   to put it in the proper <td> of my table

   <xsl:template name="WholeRequestMax">
      <xsl:variable name="max">
        <xsl:for-each select="row/whole-request">
          <xsl:sort data-type="number" order="descending"/>
          <xsl:if test="position()=1">
       <xsl:value-of select="."/></xsl:if>
        </xsl:for-each>
      </xsl:variable>
   </xsl:template>

   However, I return no data and my <td> is empty, can anyone tell me what
   I am doing wrong?"

The basic strategy for finding a maximum by sorting and taking the first
element is sound (so long as the number of rows doesn't get too large), and
has been discussed on the list before.  So why doesn't it work here?  You
don't really tell us enough about the context to be sure, but here are some
of the possibilities:

1.  There is no <td> in the snippet of xsl that you gave us, so your
variable "max" is going out of scope before you use it
(assuming that you wanted to use it in the template from which you called
"WholeRequestMax").
2.  Remember that calling a named template does not change the current
node.  So the current node must be the parent of your rows (which is
<profile-table> in your example.  Otherwise the for-each will return
nothing at all.

If these don't put you on the right track, try posting a little more of
your xslt.

I hope this helps.

Rick Suiter



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Re: Max of...
    • RSuiter - Thu, 8 Mar 2001 15:12:40 -0500 (EST) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.