Bug 7849

Summary: xpath evaluator doesn't use scoped variable in select
Product: Taglibs Reporter: Stephanie Bodoff <stephanie.bodoff>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: CLOSED FIXED    
Severity: blocker    
Priority: P3    
Version: 1.0B1   
Target Milestone: ---   
Hardware: Sun   
OS: Solaris   

Description Stephanie Bodoff 2002-04-08 19:14:09 UTC
When provide a scoped variable to a select, abook has all empty values. If I use
a constant to select a particular id, it works. 

<x:parse var="booklist" >
<books>
  <book id="201">
    <lastname>Duke</lastname>
    <firstname></firstname>
    <title>My Early Years: Growing up on *7</title>
    <price>10.75</price>
    <year>1995</year>
    <description>What a cool book.</description>
    <inventory>20</inventory>
  </book>
  <book id="202">
    <lastname>Jeeves</lastname>
    <firstname></firstname>
    <title>Web Servers for Fun and Profit</title>
    <price>10.75</price>
    <year>2000</year>
    <description>What a cool book.</description>
    <inventory>20</inventory>
  </book>
  <book id="203">
    <lastname>Masterson</lastname>
    <firstname>Webster</firstname>
    <title>Web Components for Web Developers</title>
    <price>17.75</price>
    <year>2000</year>
    <description>What a cool book.</description>
    <inventory>20</inventory>
  </book>
</books>
</x:parse>
	
<c:if test="${param.bookId != null}">
<x:set var="abook" select="$booklist/books/book[@id=$param:bookId]" />
<h2><x:out select="$abook/title"/></h2>
</c:if>
Comment 1 Shawn Bayern 2002-04-08 19:28:57 UTC
Thanks for the report, Stephanie.  This works now; there may have been a bug 
immediately post-Beta1, or perhaps in Beta1 itself.

By the way, 'param' indicates a request parameter, not a scoped variable.  Just 
wanted to make sure we're talking about the same thing.  If I load your test 
page with a query string of "?bookId=203" (leading to "$param:bookId=203"), I 
get the correct book title.

Also, how much would it cost my publisher in promotional dollars to add my 
books to your list?  :-)