Ok after a few days !!!
I came up with this:-
<c:setVariable select="cardinality($action/@rightOperand , 0)"
var="hasRightOperand"/>
<c:when test="$hasRightOperand">
.. . .. insert exist code to perform . . ..
</c:when>
<c:otherwise>
....... insert otherwise code to peroform. . ..
</c:otherwise>
</c:choose>
"Stu" <evaandoli@dodo.com.au> wrote in message
news:eu0v03$afr$1@utils.eclipse.org...
> Is it possible to check whether a tag exists in the file ?
> something like
> <c:when exists $node/@name>
>
> . . . blah blah
>
> </when>
>
>
It's easier than you think. XPath has rules for turning any value into a
boolean (here's a link to the XPath 'boolean' function: http://www.w3.org/TR/xpath#function-boolean).
What you need:
<c:when test="$node/@name">
According to XPath, the expression '$node/@name' returns a NodeSet (in this
case, a set of Attribute nodes). If the attribute is not set, the NodeSet is
empty. XPath converts a NodeSet to boolean based on the cardinality of the
NodeSet. Anything larger than zero implies true, zero implies false.
Paul
"Stu" <evaandoli@dodo.com.au> wrote in message
news:eu0v03$afr$1@utils.eclipse.org...
> Is it possible to check whether a tag exists in the file ?
> something like
> <c:when exists $node/@name>
>
> . . . blah blah
>
> </when>
>
>