Subject: Re: [xsl] Locating an attribute and its value indirectly|
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Fri, 4 Nov 2011 23:07:48 -0700
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
-- 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