Bug 33032 - string() works incorrectly in conjunction with scoped variables
Summary: string() works incorrectly in conjunction with scoped variables
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.1
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2005-01-11 00:10 UTC by Yuriy Yatsyk
Modified: 2009-11-29 19:57 UTC (History)
0 users

Example showing 33032 is a bug (1009 bytes, text/plain)
2006-12-06 13:41 UTC, Henri Yandell

Note You need to log in before you can comment on or make changes to this bug.
Description Yuriy Yatsyk 2005-01-11 00:10:40 UTC
Below are two snippets of code, first one works (i.e. variable is initialized to
string correctly), second one does not (variable is set to empty string). The
only difference is that in the first one function string() is used on a simple
variable instead of complex expression.

Working snippet:

<x:set var="navigationPath" select="$content/content/pages/page/url[text() =
$contentUrl]/../navigation-path" scope="request"/>
<x:set var="navigationPath" select="string($navigationPath)" scope="request"/>

Non-working snippet:

<x:set var="navigationPath"
select="string($content/content/pages/page/url[text() =
$contentUrl]/../navigation-path)" scope="request"/>
Comment 1 Dhiru Pandey 2005-03-03 22:29:48 UTC
Could the submitter please attach a testcase so that one could reproduce the

Comment 2 Henri Yandell 2006-12-06 13:41:23 UTC
Created attachment 19219 [details]
Example showing 33032 is a bug

Here's a jsp file that when dropped into the standard-examples/xml/ directory
shows this bug.
Comment 3 Henri Yandell 2006-12-06 15:24:07 UTC

It doesn't seem to be a problem with Xalan itself. An xsl with the following in
works fine:

<xsl:template match="/">
    <xsl:value-of select="string(games/country/athlete/sport[text() =

However, the call to Xalan via JSTLXPathUtils is returning an XObject that
contains an empty string. There's nothing obviously different between the calls
to the XPath API, just the addition of the test variable to the scope. Seems to
imply to me that the problem is one of the taglib not calling down to Xalan in
quite the right way and will be painful to resolve. 

JSTLXPathUtils is a fork of a Xalan class (XPathUtils), but I can't see anything
obvious in its svn history that would suggest a fix to this.

Given that it can be worked around pretty easily - my suggestion would be to put
it in a FAQ of known bugs.
Comment 4 Henri Yandell 2007-01-29 16:59:53 UTC
Added to the FAQ:

Comment 5 Henri Yandell 2009-11-29 19:57:05 UTC
Resolving as wontfix. No obvious path to resolution; this isn't a part of the spec I would rely on.