Subject: Re: [xsl] Converting Flat XML to Hierarchical structure using xsl. From: Arulraj <p_arulraj@xxxxxxxxx> Date: Mon, 14 Nov 2005 02:34:54 -0800 (PST) |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Converting Flat XML to Hi, Ragulf Pickaxe | Thread | Re: [xsl] Converting Flat XML to Hi, Ragulf Pickaxe |
Re: [xsl] Conditionally use attribu, David Carlisle | Date | Re: [xsl] Converting Flat XML to Hi, Ragulf Pickaxe |
Month |