Determining the Position Number of a Node

The position() function returns an integer that indicates the position of the node within the parent. Positions start with 1; a node with a position of 1 is always the first node in the collection.

For example, the following query returns the first three degree elements in the document:

(//degree)[position() < 4] 
               

            

The next query finds the first two book children in the current context:

book[position() <= 2] 
               

            

The XPath processor executes the position() function with respect to the parent node. Consider the following data:

<x>
               

              
<y/>
                   
<y/>
                   

                
</x> <x>
<y/>
                   
<y/>
                   

                
</x>

The following expression returns the first y element contained in each x element:

x/y[position() = 1] 
               

            

For more information, see also Finding an Element with a Particular ID.

Xerces - Parsing and Validating XML with the Apache Xerces Parser

The Xerces Parser supports the XML 1.0 recommendation and W3C's XML Schema recommendation version 1.0, DOM and SAX. Learn how easy it is to use Apache Xerces directly in Stylus Studio to parse and validate XML with ease.

Publishing & Printing

It is really hard to get things to look pretty, especially XML. That's why these publishing & printing companies use Stylus Studio to make a Mona Lisa out of data integration. Check out these top companies that are "stunning" with Stylus Studio!

XQuery Blasts off at NASA's Johnson Space Center

This is a short story how DynCorp (CSC) used XQuery at NASA's Johnson Space Center to Simplify XML Data Access and Integration

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.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member