XPath Not() function always returning false AND <x:forEach> context question.
"Sébastien Brodeur" <[email protected]>
| Newsgroups | gmane.comp.jakarta.taglibs.user |
|---|---|
| Message-ID | <[email protected]> |
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