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

RE: Using position() with sorted node

Subject: RE: Using position() with sorted node
From: "Diamond, Jason" <Jason.Diamond@xxxxxxx>
Date: Tue, 13 Mar 2001 14:13:21 -0600
xsl position of sorted output
[Sorry about the previous premature send.]

Hi, Jenny.

position() does return the position of the current node in the current node
list (which is created using an <xsl:apply-templates> or <xsl:for-each> with
or without any <xsl:sort> elements.) Unfortunately, sorting the node list
makes accessing the preceding nodes rather tricky since the preceding and
preceding-sibling axes work on the document and not the sorted node list.

Can you show a little more of the code in question? When you say that it
needs to reference the previous node, do you mean that it needs to include
the string value of the previous node in the href attribute or something
similar? Is this sample within a sorted <xsl:for-each>? Can we get a small
snippet of the source document (even if it's just the nodes in question)?

Jason.

-----Original Message-----
From: Jenny Simpson [mailto:simpson@xxxxxxxxxxx]
Sent: Tuesday, March 13, 2001 10:48 AM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Using position() with sorted node


I have an xml document whose nodes are being sorted according to date.  I
am trying to use the position() function to reference these nodes, but
since they are sorted, their processing/output order is different from the
original document order.  Furthermore, I am using several for-each
statements which make it even more difficult to use position() since the 
position index starts back at 1 for each different set of nodes being
processed.  Is there a way to use position() or a similar function to 
reference the position of sorted nodes?  

Here is an example of the code I'm looking at.  This particular piece of
code was written by Jeremy Quinn.  Instead of day= referencing the
position of the node in the output, I need it to reference the node which
is processed immediately before this piece of code is executed.

<a>
        <xsl:attribute name="href">form/item-edit.xml?day=<xsl:value-of
        select="position()"/></xsl:attribute>
        <xsl:text>[edit]</xsl:text>
</a>

Thanks.  

Jenny Simpson


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

 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.