smandape
smandape

Reputation: 1043

Simple question about boolean operator in XSLT

The XML file I want to extract data from looks as below:

`<groups>
  <group>approved</group>
  <group>withdrawn</group>
</groups>`  

I am using 'if' statement on this part of code to give me the data only if it is approved and don't give me the data if it has both groups(approved and withdrawn). I tried doing something but its not giving me the output. I tried the following:

<xsl:if test="groups/group='approved' and group!='withdrawn'">
<xsl:value-of select="name"/><xsl:text>

I also tried other things, but couldn't really get there. If anyone can help me with this simple question that will be really great. Thank you.

Upvotes: 1

Views: 223

Answers (1)

Grzegorz Szpetkowski
Grzegorz Szpetkowski

Reputation: 37954

I am using 'if' statement on this part of code to give me the data only if it is approved and don't give me the data if it has both groups(approved and withdrawn).

I guess that you're looking for something like:

<xsl:if test="groups/group='approved' and not(groups/group='withdrawn')">
    <!-- some stuff -->
</xsl:if>

Upvotes: 2

Related Questions