xsl-list
[Top] [All Lists]

Re: [xsl] Grouping: maximum of n groups

2012-09-14 10:40:40
Hi,

On 9/14/2012 10:15 AM, Michael Kay wrote:
> This sounds to me like a candidate for sibling recursion, i.e. avoid the
> grouping constructs entirely, and process the sequence using a head/tail
> recursive function (or apply-templates along the following-sibling axis).

This is true and I'm a huge fan of sibling recursion, but Mike's first suggestion will handle this as well.

That is, if the results of your grouping operation are bound to a variable, you can then process these results to group your groups by position or whatever.

Of course this is a micropipeline.

Cheers,
Wendell

On 14/09/2012 14:15, Norbert Heidbrink wrote:
Hi everybody,

is there a way to limit the number of groups that are constructed by
<xsl:for-each-group>?


XML:
<line>
v <tab /> w <tab /> x <tab /> y <tab/> z
<line>

(v, w, x, y, z being mixed data)


In the example above,
<xsl:for-each-group select="node()" group-ending-with="tab">
will find 5 groups.

Let's say I want no more than 3 groups, where the third group contains
"all the rest":
(1) v <tab />
(2) w <tab />
(3) x <tab /> y <tab/> z

To be more precise:
Groups 1 and 2 shall be processed on their own,
Groups 3 and all following groups shall go together in further
processing.



Thanks for your answers,
Norbert

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--
======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>