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

Re: Converting Flat XML to Hierarchical structure usin

Subject: Re: Converting Flat XML to Hierarchical structure using xsl.
From: Arulraj <p_arulraj@xxxxxxxxx>
Date: Mon, 14 Nov 2005 02:34:54 -0800 (PST)
xml ordered elements
Thanks for the suggestion..

I want to get the output in Hierarchical order using
the text().

I have modified the XSL, it follows:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="office">
<layout>
 <xsl:apply-templates
select="ordered-list/list-item"/>
</layout>				
</xsl:template>

<xsl:template match="list-item">
 <xsl:choose>
   <xsl:when test="./h">
       <xsl:element name="{./h}">
	 <xsl:apply-templates
select="ordered-list/list-item"/>
	</xsl:element>
   </xsl:when>
   <xsl:otherwise>
	<xsl:apply-templates
select="ordered-list/list-item"/>
   </xsl:otherwise>
  </xsl:choose>	
</xsl:template>
</xsl:stylesheet>

I got the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
	<Application/>
	<Processgroup/>
	<Process/>
	<PanelName/>
</layout>

But my expected output is:
<layout>
	<Application/>
	  <Processgroup>
	    <Process>
  	      <PanelName/>
	    </Process>
	 </Processgroup>
	</Application>
</layout>

Regards,
Raj
--- Ragulf Pickaxe <ragulf.pickaxe@xxxxxxxxx> wrote:

> Raj,
> 
> >    <xsl:apply-templates
> select="ordered-list/list-item/"/>
> 
> If you want to select list-item elements, the above
> should be:
> <xsl:apply-templates
> select="ordered-list/list-item"/> (that is,
> without the trailing /).
> 
> From the output I expect that you get the default
> templates. That
> would then be why you get the text() elements in the
> output.
> 
> The match="ordered-list/list-item/" should be
> match="ordered-list/list-item".
> And in this example, you could as well have
> match="list-item".
> 
> Ragulf Pickaxe :-)
> 
> 



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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.