Hi,
Here's a XSLT2.0 solution (Not tested).
<xsl:template match="p">
<xsl:for-each-group select="node() group-adjacent="self::enn">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<xsl:copy-of select="current-group()">
</xsl:when>
<xsl:otherwise>
<p>
<xsl:copy-of select="current-group()">
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:template>
p.s: This solution was taken from the archive
Cheers,
Prakash
Arulxml(_at_)netscape
.net To:
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc: (bcc:
omprakash.v/Polaris)
06/25/2005 12:16 Subject: [xsl] Converting Child
to Sibling
PM
Please respond
to xsl-list
Dear All,
I am converting one XML to another form of XML by using XSLT, in my source
XML, I have ‘enn’ element, which is the child of ‘para’ element. I require
in my resulting XML ‘enn’ element should be sibling of ‘para’ then how the
XSLT should look.
Source XML
<root>
<para>Normal <i>italic</i> text, normal <b>bold</b> text, normal
<s>sarif</s> text</para>
<para>Normal <i>italic</i> text, <enn>normal <b>bold</b> text</enn>, normal
<s>sarif</s> text</para>
<para>Normal <i>italic</i> text, normal <b>bold</b> text, normal
<s>sarif</s> text</para>
</root>
Resulting XML
<root>
<para>Normal <i>italic</i> text, normal <b>bold</b> text, normal
<s>sarif</s> text</para>
<para>Normal <i>italic</i> text, </para><enn>normal <b>bold</b>
text</enn><para>, normal <s>sarif</s> text</para>
<para>Normal <i>italic</i> text, normal <b>bold</b> text, normal
<s>sarif</s> text</para>
</root>
Please advice
Many thanks in advance
Arul Kumar
__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at
http://isp.netscape.com/register
Netscape. Just the Net You Need.
New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
--~------------------------------------------------------------------
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>
--~--
This e-Mail may contain proprietary and confidential information and is sent
for the intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction,
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its
attachment other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in