Hello,
I might put starting-with="*[col1='PR']" if only because
more concise
more closely matches abstract logic (arguably)
Of course one might also make the opposite argument.
Regards, Wendell
On Thu, Jun 5, 2025 at 3:30b/PM Terry Badger terry_badger@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Slight change
> <xsl:template match="root">
> <xsl:copy>
> <xsl:for-each-group group-starting-with="record[col1[. =
> 'PG']]" select="record">
> <group>
> <xsl:copy-of select="current-group()"/>
> </group>
> </xsl:for-each-group>
> </xsl:copy>
> </xsl:template>
>
> Terry Badger
>
>
>
>
>
>
> On Thursday, June 5, 2025 at 02:56:28 PM EDT, Martin Honnen
> martin.honnen@xxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>
>
>
>
>
>
>
>
> On 05/06/2025 20:49, rick@xxxxxxxxxxxxxx wrote:
>
>
> >
> > Here is my XML:
> >
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <root>
> >
> > <record>
> >
> > <col1>PG</col1>
> >
> > </record>
> >
> > <record>
> >
> > <col1>1</col1>
> >
> > </record>
> >
> > <record>
> >
> > <col1>2</col1>
> >
> > </record>
> >
> > <record>
> >
> > <col1>PG</col1>
> >
> > </record>
> >
> > <record>
> >
> > <col1>3</col1>
> >
> > </record>
> >
> > <record>
> >
> > <col1>4</col1>
> >
> > </record>
> >
> > </root>
> >
> >
> >
> > I want to group all of the <record> elements, starting with
> col1[starts-with(.,bPGb)]. I am expecting 2 groups of 3 record elements
> each.
> >
>
>
>
>
> A variant of your code with e.g.
>
> <xsl:template match="root">
>
> <xsl:copy>
>
>
> <xsl:for-each-group select="record"
> group-starting-with="record[col1[.='PG']]">
>
> <group></group>
>
> </xsl:for-each-group>
>
> </xsl:copy>
>
> </xsl:template>
>
> would do that. Remember, the group-starting-with is a pattern the element
> to start a group has to match.
>
>
>
>
> XSL-List info and archive
> EasyUnsubscribe (by email)
>
>
>
--
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...
|