tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: <x:if question
Date Fri, 25 Jun 2004 12:22:32 GMT
Is this the kind of thing you mean?

<%@ page contentType="text/plain" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>

<x:parse var="error">
<root>
    <error></error>
</root>
</x:parse>

<x:parse var="data">
<root>
    <data></data>
</root>
</x:parse>

error:
<x:if select="$error/root/error">
error node exists
</x:if>

data:
<x:if select="$data/root/error">
error node exists
</x:if>


Which produces:

error:

error node exists

data:

In other words, the error node was found in $error but not in $data.

Quoting David Goodenough <david.goodenough@btconnect.com>:

> I have an application where I send an XML structure to an HTTP host (using
> the
> io taglibs) and get an XML response.  That response always has the same root
> tag, but what comes back either has an <error> (with attributes and
> children)
> or some application dependant data.
> 
> I have tried a variety of values in the <x:if select="", but none of them 
> quite seem to work.  So my question is, what is the correct syntax for
> detect
> the presence (not non-null value) of an XML node?
> 
> Thanks in advance
> 
> David

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message