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

Re: RE: XSLT - How to find the last element in a group

Subject: Re: RE: XSLT - How to find the last element in a group of nodes inside of a for loop
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 17 Jan 2008 14:53:50 -0500
Re:  RE: XSLT - How to find the last element in a group
Alice,

At 02:26 PM 1/17/2008, you wrote:
Referring to your question, have you tried using <xsl:value-of select="@zone[last()]">?

That won't work, since selecting @zone is selecting the 'zone' attribute of the context node, of which, if there is any at all, there is (only) one, so either you get the 'zone' attribute or you don't. In no case is it a method of selecting from among a set of 'zone' attributes.


Nor did the OP have 'zone' attributes: they are elements. But "zone[last()]" won't pick what he wants either, since it selects the last of the 'zone' element children of the context (a long way of saying the same thing is "child::zone[position()=last()]", but note that the functions 'position()' and 'last()' return different values when used in a predicate than they do when they are evaluated within the context of a template match. So what will be returned is the last 'zone' child element in document order, not in the sorted order the OP wants.

But don't worry: the question as stated was simple enough, and if Harsh doesn't now have the info he needs, he can post again to clarify.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

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.