tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sébastien Brodeur" <brods...@gmail.com>
Subject XPath Not() function always returning false AND <x:forEach> context question.
Date Fri, 06 Oct 2006 15:05:36 GMT
We are migrating from WebSphere 5 (and JSTL 1.0) to WebSphere 6 (JSTL 1.1).

We have some incompatibility issues.

When I try to use the XPath not() function to evaluate if a select statement
will return something, I always get false.

Example:

<?xml version="1.0" encoding="ISO-8859-1"?>
<books>

  <collection>
    <name>My collection</name>
  </collection>

  <book id="1">
    <author>Isaac Asimov</author>
    <title><![CDATA[La cité des robots]]></title>
    <year>1980</year>
  </book>
</books>

...
<x:when select="not($xml/books/book[id=1]">
...

Will return false EVEN if the id exist.


Also, when I uses <x:forEach>, I can't no longer access XML node outside the
scope of the select.  I have to use a 'weird' syntax to access those nodes.

Work in JSTL 1.0 and don't in JSTL 1.1

<x:forEach select="$xml//books/book" var="current_book">
  <x:out select="$xml//books/collection/name" />
</x:forEach>

I must uses instead

<x:forEach select="$xml//books/book" var="current_book">
  <x:out select="current_book/../collection/name" />
</x:forEach>

-- 
Sébastien Brodeur

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message