Re: [xsl] Grouping but not starting at the first element.

Subject: Re: [xsl] Grouping but not starting at the first element.
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 02 Oct 2012 13:52:02 -0400
At 2012-10-02 15:58 +0000, Kerry, Richard wrote:
My input XML is shown below. It represents part of an Excel spreadsheet, hence the references to rows and columns.
...
<xsl:for-each-group select="row" group-starting-with="row[column[1][. != '']]" >
So I'm grouping based on starting with rows with column[1] not empty.


The result I get is :
<?xml version="1.0" encoding="UTF-8"?>
<page>
<item name="AT3G_UP_DN" row="1"/>
<item name="name" row="2">
<sub-item caption="caption" value="value"/>
</item>
<item name="Card fail" row="3">
<sub-item caption="Card Fail" value="0"/>
<sub-item caption="Card OK" value="1"/>
</item>
<item name="SD-SD ARC bypass" row="6">
<sub-item caption="Normal" value="0"/>
<sub-item caption="Bypass" value="1"/>
</item>
</page>

I understand why I get this. What I'd like to do is get rid of the items generated by rows 1 and 2.

Then don't include those rows when you are specifying the population to be grouped.


Can anyone advise how to go about achieving this ?

<xsl:for-each-group select="row[position()>2]" ...


I hope this helps.

. . . . . . . . . . Ken

--
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

Current Thread