xsl-list
[Top] [All Lists]

Re: [xsl] Getting variable yet most immediate parentNode

2007-09-28 10:22:56
Wendell Piez wrote:
At 11:56 AM 9/28/2007, Steve wrote:
<!-- Doesn't work. Ignores all @name -->
<xsl:value-of select="(@name|.)[1]" />

This won't work since the current node will always precede any @name attribute in document order. Try select="(.|@name)[last()]" (which adds the value of the @name attribute, if there is one, in preference to the value of the node) or the more explicit (but slightly different)


Indeed, thanks for making that clear to Steve, Wendell. I changed my XSLT 2.0 code (@name, .)[1] to XSLT 1.0 code (@name | .)[1], which is of course too hastily. Using last() is what he needs there.

Cheers,
-- Abel Braaksma

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--