Ananya
Ananya

Reputation: 1

checking the boolean value in xsl

I Have an xml

<FIELD>
 <FNAME>isFirstOfTheMonth</FNAME>
 <TYPE>SVR_BOOLEAN</TYPE>
 <VALUE>false</VALUE>
 </FIELD>
 <FIELD>

I am trying to check the boolean value. if its not the first of the month then display the text

<xsl:if test="not(FIELD[FNAME='isFirstOfTheMonth']/VALUE) =false">
  <fo:block font-family="Times New Roman" font-size="11.0pt" text-align="left">
    <xsl:text>The  liability is &#36;</xsl:text>
    <xsl:value-of select="FIELD[FNAME='amount]/VALUE" />
    <xsl:text>&#160;effective&#160;</xsl:text>
    <xsl:value-of select="FIELD[FNAME='StartDate']/VALUE" />
    <xsl:text>.</xsl:text>
  </fo:block>
</xsl:if>

when the value is false i am not seeing the text in output.

Can anyone help me? BTW xsl version 1

Upvotes: 0

Views: 870

Answers (1)

Richard
Richard

Reputation: 108975

not(FIELD[FNAME='isFirstOfTheMonth']/VALUE) =false

I think that closing parenthesis is in the wrong place. You are comparing the result of the not to false, do you want to compare the content of the VALUE element to "false"? In which case using not-equals would be better:

FIELD[FNAME='isFirstOfTheMonth']/VALUE != 'false'

noting that you need to put strings in quotes…. Thus

<xsl:if test="FIELD[FNAME='isFirstOfTheMonth']/VALUE != 'false'">
  …
</xsl:if>

Upvotes: 1

Related Questions