Finding Multiple Nodes

To obtain several nodes in one operation, use the and or the or operator with the position() and last() functions. For example, the following query returns the first and the last author nodes in the current context:

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

            

You can also specify a range of nodes. For example, the next query returns the second, third, and fourth author elements:

author [(position() >= 2) and ( position() <= 4)]
               

            

To obtain a range of nodes, m to n, relative to the last node, use the following format:

(m <= position()) and (position() <= n )

For example, the following query obtains the last five nodes in the current context:

author [(last() - 4) <= position()) and (position() <= last())]
               

            

Convert DTD to XSD

learn how to convert DTD to XML Schema

XML Processing

Learn how to simplify XML Processing using Stylus Studio XML Pipeline, the easiest way to visually design and deploy virtually any XML processing tasks.

Using Stylus Studio's Database-to-XML Editor to Query and Update Relational Databases using SQL/XML

Watch and learn how easy it is to define relational-to-XML mappings for getting XML out of relational databases and updating databases from XML using industry-standard SQL/XML extensions and Stylus Studio's DB-to-XML data-source editor.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member