Subject: Re: [xsl] group-starting-with and ending with From: "Imsieke, Gerrit, le-tex gerrit.imsieke@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 6 Mar 2020 07:31:01 -0000 |
<xsl:when test="current-grouping-key()"> <z> <xsl:copy-of select="current-group()"/> </z> </xsl:when>
Hi,
Is it any possibilityB to <st> start and end tag in <bb>Test1</bb>, <bb>Test2</bb>.
Here is my XML
<a><x>To</x> Test, <bb>Test1</bb>, <bb>Test2</bb>, <cc>Test3</cc>, <dd>USA</dd></a>
Desired Output
<a><x>To</x> Test, <st><bb>Test1</bb>, <bb>Test2</bb></st>, <cc>Test3</cc>, <dd>USA</dd></a>
XSLT
<xsl:template match="a">
<xsl:element name="{local-name()}">
<xsl:for-each-group select="node()" group-adjacent="self::text() or self::x or self::dd or self::cc">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<xsl:copy-of select="current-group()"/>
</xsl:when>
<xsl:otherwise>
<xsl:for-each-group select="*" group-starting-with="self::bb">
<st>
<xsl:for-each select="current-group()">
<xsl:copy-of select="current-group()"/>
</xsl:for-each>
<xsl:copy-of select="current-group()"/>
</st>
</xsl:for-each-group>
<xsl:copy-of select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:element>
</xsl:template>
Thanks
XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/225679> (by email <>)
-- Gerrit Imsieke GeschC$ftsfC<hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de
Registergericht / Commercial Register: Amtsgericht Leipzig Registernummer / Registration Number: HRB 24930
GeschC$ftsfC<hrer / Managing Directors: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] group-starting-with and endin, Byomokesh Sahoo saho | Thread | Re: [xsl] group-starting-with and e, Mukul Gandhi gandhi. |
[xsl] group-starting-with and endin, Byomokesh Sahoo saho | Date | [xsl] tricky text and structure tes, Trevor Nicholls trev |
Month |