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

Re: Locating an attribute and its value indirectly

Subject: Re: Locating an attribute and its value indirectly
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Fri, 4 Nov 2011 23:07:48 -0700
Re:  Locating an attribute and its value indirectly
Thanks Ken.
That makes sense, anchoring current() to the point at which the XPath began evaluating the expression. My more naof was view was that it "returned me" to my original context no matter what.
Mark


-----Original Message----- From: G. Ken Holman
Sent: Friday, November 04, 2011 6:27 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Locating an attribute and its value indirectly


At 2011-11-04 17:05 -0700, Mark wrote:
That works. I think I get it.

Did my " <xsl:value-of select="../Formats/@*[name(.)=@text-location]"/>"try to find @text-location in the <Formats> element?

Yes, because expressions in the predicate are evaluated against that node that was selected in the step.

And your "<xsl:value-of select="../Formats/@*[name(.)=current()/@text-location]"/>" switched the path back to the current context where @text-location actually resides?

The current() function returns that node that was current at the beginning of the evaluation of the XPath expression.

Which, in your case, is the context where @text-location resides,
thus Brandon's current()/@text-location works.

In other situations you may find yourself walking from that place to
find another node, as in current()/../@idref

I didn't want you to think current() was magic in knowing where
@text-location was, it was just coincidentally attached to the
element that was current at the beginning of the XPath expression evaluation.


I hope this is helpful.

. . . . . . . . . . Ken

--
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/t37DVX
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

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.