Syntax for Specifying an Axis in a Query

The previous sections provide examples of XPath expression syntax that uses abbreviations. This section introduces you to the axis syntax that many of the abbreviations represent. For a list of XPath abbreviations, see XPath Abbreviations Quick Reference.

You can use axis syntax to specify a location path in a query. An axis specifies the tree relationship between the nodes selected by an expression and the context node. The syntax for specifying an axis in a query is as follows:

axis_name ::node_test

The axis names are defined in Supported Axes.

A node test is a simple expression that tests for a specified node type or node name. For example:

  • node() matches any type of node.
  • text() matches text or CDATA nodes.
  • comment() matches comment nodes.
  • processing-instruction() matches any processing instruction.
  • processing-instruction(name ) matches processing instructions whose target is name.
  • name matches elements or attributes whose name is name.
  • * matches any elements or any attributes.

XPath 2.0 adds additional tests, such as

  • element() matches any element node
  • attribute() matches any attribute node
  • document-node() matches any document node

In addition, you can follow the node test with any number of filters.

Sybase

Sybase Adaptive Server Enterprise (ASE) is a powerful high-performance database for recording and retrieving business records. Learn how to develop XML applications for Sybase using Stylus Studio.

Microsoft XML Tools

Build Microsoft XML applications with Stylus Studio, which includes development support for all Microsoft XML technologies, including MSXML and Microsoft System.XML (Microsoft XML Parsers), SQL Server 2000, SQL Server 2005 (Yukon), and more.

DTD Validator

This page talks about Stylus Studio's DTD Validator it has the ability to specify any third-party XML parsers and validators, real-time syntax checking and DTD validation error reporting, backmapping, integrating third-party DTD validators and more!

XML to PDF

Convert XML to PDF using Stylus Studio's XML publishing tools - the easiest way to design beautiful document layouts for use in XSL:FO based multi-channel publishing and single source publishing applications.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member