Re: [xsl] Get value from $Variable

Subject: Re: [xsl] Get value from $Variable
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Tue, 17 Mar 2009 10:09:23 +0000 (GMT)
XSL-List wrote:

  Hi,

  BTW, the name XSL-List, I thought that was Tommie writing...

> <xsl:value-of select="$Language/Weekdays/Weekday[@Wd_Id = @Id]"/>

> I get the same day of the week (1) with this query. Is it
> possible to get it some other way without the Variable?

  That's because '[' changes the current item.  So [@Wd_Id = @Id] accesses two
attributes, named Wd_Id and Id, from the same node.  There are two solutions:
using a variable, or using current().  current() returns the context node at
the beginning of the XPath expression (right before evaluating $Language in
your example):

    $Language/Weekdays/Weekday[@Wd_Id = current()/@Id]

  Regards,

--
Florent Georges
http://www.fgeorges.org/

Current Thread