Bug 8486

Summary: x:when does not seem to work as defined
Product: Taglibs Reporter: Prasad Subramanian <prasad.subramanian>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: other   

Description Prasad Subramanian 2002-04-24 19:24:36 UTC
I have a two x:when statements and x:otherwise inside a x:choose .
Though the XPath expression that I use evalutes correctly ( i used x:out to 
determine this )

However the first block of x:when is evaluated everytime.

Seems like a basic issue : Just want to make sure that I am doing it correctly.
=====================================================================
<%@taglib uri="http://java.sun.com/jstl/ea/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jstl/ea/xml" prefix="x" %>
<%@page import="javax.xml.transform.stream.*,java.io.*" session="true" %>
 <jsp:include page="menu.jsp" />
 <c:import url="activity.xml" varReader="xmlImport" >
	<x:parse xml="${xmlImport}"  varDom="txDom" />
 </c:import>

  	

<x:forEach select="$txDom//activities/activity" >
<x:out select="status" />
<x:out select="status='WIP'" />
<table border="1">
	<x:choose>
		<x:when select="status='Completed'" >
		<b>These are the activities that are In progress </b>
		<tr>
			<td><x:out select="@id" /></td>
			<td><x:out select="description" /></td>
			<td><x:out select="resp_engr" /></td>
		</tr>
		</x:when>
		
		
		<x:when select="status='WIP'" >
		<b>These are the activities that are Completed </b>
		<table>
		<tr>
			<td><x:out select="@id" /></td>
			<td><x:out select="name" /></td>
			<td><x:out select="resp_engr" /></td>
		</tr>
		</table>
		</x:when>	
		<x:otherwise>
		<b>These are the activities that are Planned </b>
		<table>
		<tr>
			<td><x:out select="@id" /></td>
			<td><x:out select="name" /></td>
			<td><x:out select="resp_engr" /></td>
		</tr>		
		</table>
		</x:otherwise>
		
	</x:choose>	
</table>	

</x:forEach>
Comment 1 Shawn Bayern 2002-04-24 20:23:12 UTC
Thanks - this is a known bug, though it wasn't noted in Bugzilla.  It's a
problem with Jaxen that has been fixed by an updated release; the problem should
go away as we move to the new Jaxen version.
Comment 2 Shawn Bayern 2002-04-29 16:37:34 UTC
Fixed as promised in current CVS head via integration with new FCS 1.0 versions
of Jaxen and SAXPath.