Re: [xsl] simple tree problem ...

Subject: Re: [xsl] simple tree problem ...
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 24 Oct 2001 22:42:41 +0200
<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>

Hope this helps,

Joerg

> Well, a simple newbie question:
> 
> First there was a tree ...
> <snip>
> <position>         1
>    <position>      2
>      <position/>   3
>    </position> 
>    <position/>     4
> </position>
> <position/>        5
> </snip>
> 
> (values only to explain sample)
> 
> Now I want first the positions 1 and 5 , than 2 and 4 and
> last but not least the 3rd one. (From parent to all childen 
> and their children ...)
> 
> One problem: I don't know the maximum child levels (here 3), 
> they can be different (2 - 4 levels). How can I count them?
> 
> Output:  <xsl:for-each select="./position"> for the first 
> childs ... but how do I get through all the other levels?
> 
> Thanks for help.
> 
> Ingo


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread