RE: [xsl] possible? for-each-group inside a for-each-group

Subject: RE: [xsl] possible? for-each-group inside a for-each-group
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 2 Mar 2005 15:10:12 -0000
> I am trying a for-each-group inside another one, is this 
> possible, or do I have to do this in two following transformations??

Yes. it's absolutely possible. You can nest for-each-group statically, or
dynamically, or both. I often nest it recursively.
> 
> I tried following stylesheet. Thought about adding a 
> current-group() inside the group-ending-with statement, 
> didn't work either.
> 
> <tatbestand>
> 	<xsl:for-each-group 
> select="par[@class='Entsch_normal'][not(inline[@class='*Gesetz
> esstelle'])]" 
> group-starting-with="par[@class='Entsch_normal'][inline[@class
> ='*fett']]">

Since every item in the population is a par element with
@class='Entsch_normal', including this in your starting-with condition is
rather redundant.
> 	
> 		<xsl:for-each-group select="*" 
> group-ending-with="par[@class='Entsch_normal'][inline[@class='
> *fett']]">

Normally the inner grouping will select all the items in the outer group.
select="*" selects the children of the context item, which is the first item
in the current group. The most common usage is to use
select="current-group()" in the inner grouping. Perhaps you want
select="current-group()/* - but I'm not sure, I don't understand your
requirements well enough.

Michael Kay
http://www.saxonica.com/

Current Thread