File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Counting nodes using xsl:key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Counting nodes using xsl:key" Watch "Counting nodes using xsl:key" New topic

Counting nodes using xsl:key

V Chauhan
Ranch Hand

Joined: Nov 15, 2002
Posts: 70
Hi Ranchers,

I have the following xml data.

I need to generate the count of teachers and doctors for each state i.e., the output xml should look like the following.

I wrote a xslt file to group the number of nodes based on location.

However I am not able to add another level of grouping to this xslt to group nodes based on profession (in addition to location). Something like using two group by clauses in a sql query. Any ideas or suggestions?

Thanks in advance,
Clifton Craig
Ranch Hand

Joined: May 26, 2006
Posts: 103
Have you tried something like this? (completely off my head and untested and not garunteed...)

That's just a guess at something you could try.
(All code samples are provided as is and should be used as directed. Do not use if you are pregnant or expect to become pregnant. Certain usage may run the risk of baldness and/or blindness. Consult your tech manual if you experience pain or swelling as this may a symptom of a serious related illness.)

Holla at me...<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Counting nodes using xsl:key
It's not a secret anymore!