This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Peculiar variable assignment


> <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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]