About Node Positions

The node positions for a node set start with 1. Evaluation of the position number is always based on document order. For example, the following query returns the first author element in the current context:

author[1] 
               

            

The next query finds the author elements (in the current context) that contain a first-name element. The query returns the third such author element.

(author[first-name])[position()=3] 
               

            

When you specify an integer in brackets, it is equivalent to calling the position() function. For example, the following queries both return the third y child element of each x child element in the current context:

x/y[3]
               
x/y[position()=3]
               

            

Tip: If you do not know the position of the node you want, a call to the position() function might help you. See Determining the Position Number of a Node.

The return value of the position() function depends on the specified axis. For example, suppose the axis is one of the reverse axes, such as preceding, ancestor, or preceding-sibling. The position() function returns the nth one in reverse document order that falls in the specified axis.

Building DataDirect XML Converter Applications with Stylus Studio

DataDirect XML Converters are Java and .NET components that enable access to any data (flat files, EDI) from your application code. Learn how to deploy XML applications today.

Using the Stylus Studio XML Grid View

This free onlince video tutorial shows how to use the Stylus Studio XML Grid View.

Apache FOP

Apache FOP is an open-source engine is available from the Apache project that renders XSL-FO into PDF and other popular document formats. Apache FOP is fully integrated with Stylus Studio's XSL:FO tools.

Scientific, Photo & Control Equipment

Scientific, photo & control equipment companies hear clicks and beeps all day. But, when it comes to data integration it needs to be done in a flash, that's why they use Stylus Studio. Come see which top companies are seeing XML in a brand new light!

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member