XSLT: Checking for the absence of an element

I’ve seen how to check for the presence of an element but what I want to do is the opposite. Is there any way to negate the xsl:if? Or is this another easy way?

Yeah that’s what I went with. I also found that you can create a nodeset and compare it to the false() method and that will work, too.

Something like this I believe:


<xsl:choose>
     <xsl:when test="/bar/foo">
     </xsl:when>
     <xsl:otherwise>
          <p>not present</p>
     </xsl:otherwise>
</xsl:choose>