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

Re: is there really a need for location steps of ".."?

Subject: Re: is there really a need for location steps of ".."?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 12 Mar 2003 14:39:40 -0500
Re:  is there really a need for location steps of ".."?
Robert,

At 12:05 PM 3/12/2003, you wrote:
my original question was based
more on aesthetics than efficiency.

Aesthetics is certainly a worthy concern.


it just struck me as curious that so many of the examples
i saw in the docs i was reading insisted on creating paths
that involved "backing up" to parents or ancestors, that's
all.

This may be due in part to the manuals' interest in demonstrating how XPath allows you to walk all over the tree when you build location paths with multiple steps. This needs to be demonstrated in the books but it could be that in Real Life it's just a bit less common to need to do this than one might expect (though occasions are certainly not unheard of especially for ill-designed source formats). Examples cooked for demonstration aren't really coming from the same direction as RL examples: oddly, in the books the author actually has a legitimate reason to say "look you can use this complicated thing", which may sometimes obscure a simpler solution to the problem (artificially) posed.


  i was just taking it as a challenge to rewrite such
paths using the second form.

It's a worthwhile challenge.


The axes and their application are redundant by design, and of course it's always possible to say

../*/..

to get one's parent (and other such silliness) -- much more egregious than what you've found -- and yet believe it or not stuff like that occasionally turns up in the wild.

For example, some XSLTers apparently think they need to do

<xsl:template match="//element">
  <xsl:apply-templates/>
</xsl:template>

possibly because they haven't quite clicked with the distinction between matching and selecting that Lars and Jeni are talking about back over in that there other thread.

Cheers,
Wendell


___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_ "Thus I make my own use of the telegraph, without consulting the directors, like the sparrows, which I perceive use it extensively for a perch." -- Thoreau


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.