GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes Grouping using XSLT 2.0  (question for Dmitry Kirsanov) 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 "Grouping using XSLT 2.0  (question for Dmitry Kirsanov)" Watch "Grouping using XSLT 2.0  (question for Dmitry Kirsanov)" New topic
Author

Grouping using XSLT 2.0 (question for Dmitry Kirsanov)

sateesh arumbaka
Greenhorn

Joined: Nov 22, 2002
Posts: 6
I tried grouping with XSLT but couldnt get it to work,

I heard that XSLT 2.0 has some special functions/support for grouping.
Can you please explain this with an example.

Thanks,
Sateesh
[ July 15, 2004: Message edited by: sateesh arumbaka ]
Dmitry Kirsanov
Author
Ranch Hand

Joined: Apr 26, 2004
Posts: 33
The definitive (but easy to understand) grouping examples are right here:

http://www.w3.org/TR/xslt20/#grouping-examples

Basically, the grouping feature may be called "for-each on steroids". The new instruction, for-each-group, works similar to for-each, but on each iteration it gives you a group of nodes instead of a single node. This group, accessed by current-group() in XPath, can be further sorted, filtered, transformed, etc. The best thing about that is that the groups may be selected based on a wide variety of tests, such as common value, adjacency, starting/ending node etc.
 
GeeCON Prague 2014
 
subject: Grouping using XSLT 2.0 (question for Dmitry Kirsanov)