|
XML Home
XML Tutorial About XML XML Viewers XML Editors XML Documents XML Syntax XML Elements XML Attributes XML with CSS XML with XSL XML Namespace XML Local Namespace XML Default Namespace XML Entities XML Creating Entities XML CDATA DTDDTD IntroductionDTD DOCTYPE DTD Internal DTD External DTD Combined DTD FPI DTD Elements DTD Element Operators DTD Attributes DTD Attribute Default Values DTD Attribute Types DTD General Entities DTD Parameter Entities DTD Embedded Images XSLTXSLT IntroductionXSLT Example XSLT Syntax XSLT <template> XSLT <apply-templates> XSLT <value-of> XSLT <for-each> XSLT <sort> XSLT <if> XSLT <choose> XPathXPath IntroductionXPath Location Path XPath Location Path - Absolute XPath Location Path - Relative XPath Attributes XPath Axis XPath Node Test XPath Predicate XPath Node Set XPath Comparison Operators XPath Boolean Operators XPath Number Operators XPath String Functions Tutorial Summary XHTML Tutorial AJAX Tutorial |
XPath Location Path - AbsoluteAs described in the previous lesson, a location path specifies the path through the XML document's hierarchy that you'd like to work with. Your location path can be absolute or relative. If your location path starts with the root node or a forward slash ( If your location path begins with the name of a descendant, you're using a relative location path. This node is referred to as the context node. We'll look at relative location paths in the next lesson. For now, let's look at absolute location paths. Example of an Absolute Location PathConsider the following XML document:
If we wanted to select the "title" node of all albums, we could use the following (absolute) location paths:
The ResultHere are the nodes that are selected using the above location path.
The Root NodeIf we wanted to select the root node, we could use either the node's name or a forward slash. Both of these options are absolute location paths and select the root node. Option 1 - use the root node's name:
Option 2 - use a forward slash:
|
Need Website Content?
Get unique, quality digital content for your website.
|