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

Re: determining position based on predicate

Subject: Re: determining position based on predicate
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 15 Oct 2010 18:11:27 +0100
Re:  determining position based on predicate
On 15/10/2010 18:05, Terry Ofner wrote:
<xsl:when position()=count(.[lesson/lessontitle='Lesson A'])-1">

.[anything] will select either this node (if the predicate is true) or nothing otherwise, so the count is always 0 or 1.


I'd guess you intended count(../tocItem[lesson/lessontitle='Lesson A'])
although it might be ore efficient to work out that number into a variable before starting the loop or perhaps your xslt system will be smart enough to notice that the value doesn't depend on the current item if that was selected with the child axis.


David

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.