Subject: Re: [xsl] preceding-sibling in a group From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 20 May 2021 20:35:52 -0000 |
The idea is that when I see a NOTE string, I want that entry and all following within the same group to be <note> elements. So I am look for preceding-sibling or self that contains NOTE but restricted to the same group. I am using XSLT 3. Thank you very much.
<xsl:template match="dataroot"> <root> <xsl:for-each-group select="*" group-by="FIG_NO"> <entry> <figure>{current-grouping-key()}</figure> <xsl:for-each-group select="current-group()" group-starting-with="*[PART_DES[matches(., 'NOTE')]]"> <xsl:choose> <xsl:when test="self::*[PART_DES[matches(., 'NOTE')]]"> <xsl:iterate select="current-group()"> <note>{PART_DES}</note> </xsl:iterate> </xsl:when> <xsl:otherwise> <xsl:iterate select="current-group()"> <description>{PART_DES}</description> </xsl:iterate> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </entry> </xsl:for-each-group> </root> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] preceding-sibling in a gr, rick@xxxxxxxxxxxxxx | Thread | Re: [xsl] preceding-sibling in a gr, Martin Honnen martin |
Re: [xsl] preceding-sibling in a gr, rick@xxxxxxxxxxxxxx | Date | Re: [xsl] preceding-sibling in a gr, Martin Honnen martin |
Month |