• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Grouping using XSLT 2.0 (question for Dmitry Kirsanov)

 
sateesh arumbaka
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic