Finding Nodes Relative to the Last Node in a Set

To obtain nodes relative to the last node in the set, use the position() and last() functions with arithmetic. For example, the following queries both obtain the last author element in the current context:

author [position() = last()]
               
author [last()]
               

            

The following queries both return the next-to-last author element:

author [position() = last() - 1]
               
author [last() - 1]
               

            

For information about position(), see Determining the Position Number of a Node. For information about last(), see Determining the Context Size.

JSP Editor

Edit and Validate JSP 1.2 and JSP 2.0 documents. Includes JSP syntax coloring, JSP code completion and more.

EII - Enterprise Information Integration

Learn how to build EII applications with Stylus Studio's powerful Enterprise Information Integration Tools.

Stylus Studio User Guides (PDF Download)

Download Stylus Studio User Guides in printer-friendly PDF format, including documentation of past (older) versions of Stylus Studio.

Microsoft .NET XML Tools for System.XML 1.0 and System.XML 2.0

Stylus Studio features integrated XML validation, XSLT transformation and XSLT debugging using the official Microsoft .NET XML processing components: System.XML 1.0 and System.XML 2.0.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member