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

Re: XSL - using for-each with sort - can't access prev

Subject: Re: XSL - using for-each with sort - can't access previous sorted nod e
From: Rick Taylor <taylor@xxxxxxxx>
Date: Tue, 25 Nov 2003 15:16:25 -0700
Re:  XSL - using for-each with sort - can't access prev
Jeff,

Make sure that when you sort you specify the data-type
<xsl:sort select="@page" data-type="number"/>
or the 18 will come after the 1 and before the 2.

rick

At 04:45 PM 11/25/2003 -0500, you wrote:
Hi all... just joined this list. Greetings :)

I was wondering if someone might have an answer for me on this...

Here's sample XML:

<quiz>
   <question id="1" page="4"/>
   <question id="2" page="6"/>
   <question id="3" page="1"/>
   <question id="4" page="18"/>
   <question id="5" page="7"/>
   <question id="6" page="5"/>
</quiz>

In my XSLT, I want to sort by page. So I have:

<xsl:for-each select="question">
<xsl:sort select="@page"/>

Now - as I am doing things to each question during the for-each, I want to
be able to access the "id" attribute in the question outputted JUST PRIOR to
the one currently being outputted. I can't seem to be able to do this. I've
tried using position() and <xsl:number> and combinations of the two, and
have been unsuccessful. Could anyone give me some advice?

Thanks,

Jeff


**************************************************************************** This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. We may monitor email to and from our network.

****************************************************************************



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

Rick Taylor XML Developer PPDM Association


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



Current Thread

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.