Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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>
share|improve this answer
    
I think this might work, I'll try this and just doing conditional type logic in my row view template. –  PirateEric May 4 '11 at 2:40
    
Ended up doing this a different way, the response is correct, so marking it as the answer. –  PirateEric May 12 '11 at 20:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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