xsl-list
[Top] [All Lists]

Re: [xsl] determining position based on predicate

2010-10-15 12:11:38
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>