| Friday, 05-Dec-2008 01:09:25 GMT | Tell a friend |
![]() |
|
|
|
|
Originally motivated by a desire to provide a common syntax and behavior model between XPointer and XSL, XPath has rapidly been adopted by developers as a small query language.
The notation is compact, suitable for expressing within XML attributes. A typical XPath expression is a -Location Path- consisting of a string of element or attribute qualifiers separated by forward slashes ("/"), similar in appearance to a file system path. XPath also allows built-in functions, filters, bound variable access, and axis specifiers.
Location Paths are divided into Steps, each of which has three components:
A Node Test limits the specific elements or attributes which will be addressed. A common form of node test is a -name test- which is the name of an element or an attribute.
Predicates are used to filter out, or exclude, certain nodes on the basis of more complex expressions. Predicates are introduced using a square-bracket ("[", "]") syntax.
An exhaustive set of examples is beyond the scope of this article. Some typical XPath expressions which might be used in an XSL context are:
/*
//*
/*/*
FOOB[5]
FOOB[ @BAZ = "untrue" ]
See also:
Send this page |
|
|||||||
This online educational article is provided by contributions of Wikimedia Foundation. Partners: Digital Gadgets | Logo Design | Business Articles | Online Calculators | |||||||