1

I've got 2 fields in my list defined as numbers, @TotalSeats with a current value of 10 and @FilledSeats with a current value of 0. I'm trying to use some XSL Variables to handle some display logic later on in my DVWP. The issue I'm having is these fields do not want to evaluate properly.

I have this:

<xsl:variable name="IsUnlimited" select="@TotalSeats = 0" />
<xsl:variable name="Available" select="@FilledSeats &lt; @TotalSeats"/>
<xsl:variable name="IsAvailable" select="$IsUnlimited or $Available &gt; 0" />

IsUnlimited evaluates to false which is expected since it has a value of 10. Available always evaluates to false which I cannot understand why. I've tried @TotalSeats - @FilledSeats and number(@TotalSeats - @FilledSeats) and number(@TotalSeats) - number(@FilledSeats) without success.

If I use the Expression Designer interface in SPD, I can see that it is seeing the values as 10 and 0 and will evaluate to true, however when the page is loaded in the browser, the variables are all evaluating to false.

1 Answer 1

1

I don't usually use boolean logic in my select. Instead, I'll do the conditional tests in an xsl:if or xsl:choose.

So in your case, it might be something like:

<xsl:variable name="Available">
  <xsl:choose>
    <xsl:when test="@FilledSeats &lt; @TotalSeats"/>Y</xsl:when>
    <xsl:otherwise>N<xsl:otherwise>
  </xsl:choose>
</xsl:variable>
2
  • I think this might work, I'll try this and just doing conditional type logic in my row view template. Commented May 4, 2011 at 2:40
  • Ended up doing this a different way, the response is correct, so marking it as the answer. Commented May 12, 2011 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.