[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Converting Child to Sibling


Subject: Re: [xsl] Converting Child to Sibling
From: omprakash.v@xxxxxxxxxxxxx
Date: Sat, 25 Jun 2005 13:11:34 +0530

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@netscape                                                                                          
                      .net                     To:      xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                         
                                               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 bennb element, which is the child of bparab element. I require
in my resulting XML bennb element should be sibling of bparab 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@xxxxxxxxxxxxxxxxxxxxxx>
--~--



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


Current Thread
Keywords