[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: how to use // starting from the root, when i am few step

Subject: Re: how to use // starting from the root, when i am few steps under the root,
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 22 Aug 2000 08:41:40 +0100
how to use xpaths
Babu,

>        <applytemplates select="what to put here if i
>want to start from the root//ten"

If you start an XPath with '/', then it goes from the root.  If you want to
get all the 'ten' elements in the source, then the XPath you want is
'//ten'.  If you meant all the 'ten' elements from the 'root' element
(which is the document element in your case), then you can use '/root//ten'
(though this gives exactly the same effect as 'root' is the document element).

Generally you should try to avoid using '//' in your XPaths wherever
possible because it's very inefficient.  Give a step-by-step path to the
node you're interested in instead:

  /root/one/two/three/four/five/six/seven/eight/nine/ten

and don't forget that you can cut this down if you're already some way down
the tree (and an ancestor of the element you're interested in; for example,
if the current node is 'four', then you just have to do:

  five/six/seven/eight/nine/ten

you don't have to go all the way back to the root node and start again.

I hope that this helps,

Jeni

Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.