It could be that downloading the latest dom4j release might fix your problem.
 
----- Original Message -----
Sent: Monday, August 20, 2001 11:10 AM
Subject: Doubt Regarding Xtags

Hi,
 
    Here is my address.xml file
   -------------------------------------------
      <addressbook>
            <address>
                  <id>1</id>
                  <name>Guru</name>
                  <city>Chennai</city>
                  <sex>Male</sex>
           </address>
            <address>
                  <id>2</id>
                  <name>Samy</name>
                  <city>Chennai</city>
                  <sex>Male</sex>
           </address>
            <address>
                  <id>3</id>
                  <name>Sasi</name>
                  <city>Chennai</city>
                  <sex>FeMale</sex>
           </address>
      </addressbook>
 
Here is my jsp file
--------------------------
 
String sex=request.getParameter("sex"); // getting sex as Male
String city=request.getParameter("city"); // getting city as Chennai
 
 
FWIW the $sex and $city expressions in the <xtags:forEach> tag below will find the parameter values automatically. Declaring a local "sex" and "city" java instance variables is unnecessary. The $foo in XTags will try find a page, request, session, application scope attribute first called "foo" otherwise it will look for a request parameter called "foo".
 
Also are you sure that $sex and $city are valid matches? Printing out in your JSP something like
 
sex: <xtags:valueOf select="$sex"/>
city: <xtags:valueOf select="$city"/>
 
might help to check what the values of these parameters are.
 
James
 
 
<xtags:parse uri="xml/address.xml"/>
<table columns="3">
 
<tr>
         <td>id</td>
         <td>Name</td>
         <td>city</td>
         <td>sex</td>
</tr>
<xtags:forEach select="//address[sex=$sex and city=$city]">
<tr>
     <td><xtags:valueOf select="id"/></td>
     <td><xtags:valueOf select="name"/></td>
     <td><xtags:valueOf select="city"/></td>
     <td><xtags:valueOf select="sex"/></td>
</tr>
</xtags:forEach>
</table>
 
The above code should display the elements of sex=Male
and city = Chennai.ie.it should display 2 records..
But i found no display..The 'and' operator is not working..
But in xsl the same code is working..In terms of xtags i found
this difficulty..Anything wrong in my code..Pls.rectify.
 
Regards,
Paramagurusamy.
                
-------------------------------------------------------------------
Trinity Infosys India Pvt.Ltd.,
#6,Wallace Garden,2nd street,
Nungambakkam,
Chennai-600 006
Ph : 91-44-8207199/203/204 (Office)
       91-44-8572701,8525693 (Res)
E-Mail : [EMAIL PROTECTED]
Visit me at : http://balder.prohosting.com/paramu
-----------------------------------------------------------------------
 

Reply via email to