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.

XML Generator

Create sample XML instance documents from any XML Schema using the XML Generator. The generated XML document is always valid, well-formed XML!

XML-DEV Blog

Join the XML Development discussion at XML-Dev - the hottest place to talk about XML technologies, trends, systems architecture and all the latest buzz. Bookmark this RSS and ATOM feed now!

Validating EDIFACT Documents with XML Schemas

Either before or after transforming EDIFACT content, generated XML Schemas will make sure that we have all of the necessary components, our codes are all according to the standard codelists, and every little delimiter is in the right place.

Map between EDIFACT and X12

Anything can be mapped to anything: EDIFACT to X12 or vice-versa, either to XML, and any of those to flat files or other formats. Both the XSLT and XQuery mappers can help bridge complex formats with ease.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member