[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: Peculiar variable assignment


Subject: RE: Peculiar variable assignment
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Wed, 24 May 2000 14:42:09 +0100

> <xsl:variable name="bbString" select="BESTBEFORE" />
> <xsl:variable name="bbMonth"
>   select="document('')//foo:month[@name =
>     substring-before(substring-after($bbString, ' '), ' ')]/@num" />
> 
> gives $bbMonth = "05" whereas:
> 
> <xsl:variable name="bbMonth"
>   select="document('')//foo:month[@name =
>     substring-before(substring-after(BESTBEFORE, ' '), ' ')]/@num" />
> 
> gives $bbMonth = "", as does:

In the second example BESTBEFORE is used in a predicate, so the system
expects it to be a child of the foo:month element you are examining. If you
don't want to use a variable you could write current()/BESTBEFORE

Mike K


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread