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"/>
Could the submitter please attach a testcase so that one could reproduce the problem Thanks, -Dhiru
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.
Debugging... 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() = 'wrestling']/../name)"/> </xsl:template> 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.
Added to the FAQ: http://wiki.apache.org/jakarta-taglibs/Standard1%2e1%2e3FAQ
Resolving as wontfix. No obvious path to resolution; this isn't a part of the spec I would rely on.