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

Re: [xsl] Unexpected behavior with xsl:choose, xsl:when, xsl:variable


Subject: Re: [xsl] Unexpected behavior with xsl:choose, xsl:when, xsl:variable
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 8 Aug 2003 16:20:18 +0100

  <xsl:variable name="var1">
  <xsl:value-of select="parm"/>
  </xsl:variable>


Its almost always better to go


<xsl:variable name="var1" select="parm"/>

unless you really need to create a result tree fragment.
(Although that will make no difference to the result here)


> I have displayed the variable before the test for
> debugging purposes and the variable is indeed set to
> 'A', but the logic doesn't seem to follow.

are you sure it hasn't aquired any white space?
check by looking at eg
[[[<xsl:value-of select="$var1"/>]]]
or
[[[<xsl:value-of select="string-length($var1)"/>]]]

if it is white space then you may want to use

test="normalize-space($var1)='A'">


David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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



Current Thread