Re: Is it possible to count number of XML nodes in a node-set with JSTL XML tags?

Rashmi Rubdi <[email protected]>
Newsgroups gmane.comp.jakarta.taglibs.user
Message-ID <[email protected]>
Thanks again for your reply.
   
  If I'm reading your reply correctly, you are saying that we can evaluate XPath expessions with JSTL 1.1 XML Tags
   
  I got XTags from here: http://people.apache.org/builds/jakarta-taglibs/nightly/projects/xtags/ , 
   
  I had to set up my environment with dom4j and jaxen beta jar files in order to use XTags
   
  I'm not sure if XTags has a user mailing list, I wasn't able to find it. I had some further questions on XTags. 
  

Kris Schneider <[email protected]> wrote:
  Rashmi Rubdi wrote:
> Thank you for the solution
> 
> I never thought of that. I think I could use what you have suggested in cases where I transform the xml with jstl and just need the count of certain node sets.
> 
> I tried XTags, and it has a rich set of XPath capabilities, I was able to do something more complex like this inside the JSP
> 
> I wonder if one (JSTL XML Tags) is better than the other(XTags) performance wise, but may be they are just different tools with their own purpose.

I'm not sure that XTags was ever officially released. I assume you're using 
one of the nightly builds. The Standard taglib is an implementation of JSTL 
which has been officially released for both JSTL 1.0 and JSTL 1.1.

Your original code actually appears to work with Standard 1.0.6 (JSTL 1.0). 
To support XPath, Standard 1.0 uses Jaxen/SAXPath while Standard 1.1 uses 
Xalan. It's likely there's a bug in how Standard 1.1 is using Xalan to do 
its XPath evaluation. I believe XTags uses dom4j.

> Kris Schneider wrote:
> Rashmi Rubdi wrote:
> 
>>I searched for a solution for this but couldn't find an answer.
>>
>>I'm trying to count the number of book nodes from the xml below:
>>
>>
>>
>>Book Title 1
>>Book Title 2
>>Book Title 3
>>Book Title 4
>>Book Title 5
>>
>>
>>I tried using XPath's count function, inside the JSP page, but it gives 0 instead of 
>>5 - (the number of book nodes)
>>
>>
>>
>>
>>
>>Is it possible to obtain the count of a node set inside a JSP or do I have to first transform the source XML into another XML which obtains the count and then read the count from the second XML file?
> 
> 
> Hm, this works though (Standard 1.1.2):
> 
> 
> 
> 
> 
> 
> 
>>-Rashmi

-- 
Kris Schneider 
D.O.Tech 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



 		
---------------------------------
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.