This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re: simple tree problem ...
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] Re: Re: simple tree problem ...
- From: Dimitre Novatchev <dnovatchev at yahoo dot com>
- Date: Thu, 25 Oct 2001 07:22:00 -0700 (PDT)
- Reply-To: xsl-list at lists dot mulberrytech dot com
Maybe this is just a little bit more simple and efficient. Do note, that I cleaned
the source xml:
source xml:
----------
<snip>
<position id="1">
<position id="2">
<position id="3" />
</position>
<position id="4" />
</position>
<position id="5" />
</snip>
stylesheet:
----------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="snip">
<xsl:apply-templates select="child::position[1]"/>
</xsl:template>
<xsl:template match="position">
<xsl:value-of select="@id" />
<xsl:apply-templates select="following-sibling::position[1]" />
<xsl:apply-templates select="child::position[1]" />
</xsl:template>
</xsl:stylesheet>
Result:
------
15243
Cheers,
Dimitre Novatchev.
Jörg Heinicke wrote:
<xsl:template match="snip">
<xsl:apply-templates select="descendant::position">
<xsl:sort select="count(ancestor::position)"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="position">
<!-- do what you want -->
</xsl:template>
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list