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

"position()" inside a sorted apply-templates (Akin to:

Subject: "position()" inside a sorted apply-templates (Akin to: sorted for-each: preceding::sibling is not in sort order)
From: iwantto keepanon <iwanttokeepanon@xxxxxxxx>
Date: Wed, 16 Nov 2005 05:36:42 +0300 (MSK)
apply templates position
> > Working on a grouping problem I was trying to use preceding::sibling
> > on a selection of nodes that I had assembled with for-each and sorted.

I also have needed a preceding::sibling within the /sorted/ order, but I found a better algorithm 
solved that.

Here's my question, while writing a stylesheet recently I got a node's position():

<li class="count"> 
  <xsl:text>Photo </xsl:text> 
  <xsl:value-of select="position()" /> 
  <xsl:text> of </xsl:text> 
  <xsl:value-of select="$total-photos" /> 
</li>

within the context:

<xsl:apply-templates select="atom:feed/atom:entry"> 
  <xsl:sort select="position()" data-type="number" order="descending" /> 
</xsl:apply-templates>


(obviously an XSL transformation of Atom of a photo gallery)

So the last entry element (let's say 5) showed a position() of 1 ... which surprised me.  I expected to 
have to reverse the number with "$total-photos - position() + 1".

So the axes go in document order but functions do not?  I am using libxslt 1.0.

Can anybody point me to the clause in the standard where it covers axes context vs. function context?

Thx,
-- 
Rodman

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.