|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Converting Flat XML to Hierarchical structure usin
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








