[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|