tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rashmi Rubdi <>
Subject Re: Is it possible to count number of XML nodes in a node-set with JSTL XML tags?
Date Fri, 08 Sep 2006 12:05:42 GMT
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 <xtags:valueOf select="substring(/Books/Book[${item_position}]/BookTitle,
0, 50)" />  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.

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 

To unsubscribe, e-mail:
For additional commands, e-mail:

Get your email and more, right on the  new 
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message