[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: is recursion the best way to solve this?

Subject: Re: is recursion the best way to solve this?
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Tue, 01 Mar 2005 21:05:05 +0100
solve recursion
Tempore 20:44:51, die 03/01/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit anil jacob <anujcb@xxxxxxxxx>:

I have been trying to write an xsl transfor for
converting the following src xml to dest xml. No
success yet, wondering if anyone of you have faced
similar problem, appreciate if you could share any
ideas. The problem is how to wrap the OuterTag over
the InnerTag and the OuterTag can be nested.

Hi,


Playing around with 'xsl:apply-templates' and 'xsl:copy' can do the trick (there are plenty of other ways too)

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" />


<xsl:template match="/Object">
	<Root>
		<xsl:apply-templates select="*[1]"/>
	</Root>
</xsl:template>

<xsl:template match="/Object/*">
	<xsl:copy/>
	<xsl:apply-templates select="following-sibling::Object/*[1]"/>
</xsl:template>

<xsl:template match="*">
	<xsl:copy>
		<xsl:apply-templates select="following-sibling::Object/*[1]"/>
	</xsl:copy>
</xsl:template>

</xsl:stylesheet>


But I do wonder why the wanted output is not like this: <Root> <HeaderTag> <OuterTag> <InnerTag/> </OuterTag> <InnerTag/> <OuterTag> <OuterTag> <InnerTag/> </OuterTag> <InnerTag/> </OuterTag> </HeaderTag> </Root>




regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) "Et ipsa scientia potestas est" - Francis Bacon , Meditationes sacrae

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.