|
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 FREE Hosting!With every domain name you register with ZappyHost, you get FREE hosting.$1.99 Domain NamesWith every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99. |
XPath Location PathXPath programming consists of writing expressions to select the node/s you need to work with. Often, you're selecting the data within the nodes, but you could also be applying some programming logic in order to modify the output of your XML document. To select a node (or set of nodes) in XPath, you use a location path. A location path is used to specify the exact path to the node you need to select. It's a bit like using the HTML Location Path ExampleFor example, here's a simple XPath expression to select the "title" node which is a child of the "rock" node, which in turn is a child of the "albums" node:
The above expression could be applied against the following XML document:
Another ExampleIf we wanted to select the artist instead, we would use this location path:
The above expression would select the artist node instead:
XPath Location StepA location path consists of one or more location steps. The location steps are separated by either one forward slash ( Absolute Location PathYour location path can be absolute or relative. If your location path starts with the root node or a forward slash ( Relative Location PathIf 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. Enjoy this website?
Oh, and thank you for supporting Quackit! |
Need Content for your Website?Get unique, quality digital content for your website. You can even earn money by reselling it!Includes:
|