RE: [xsl] simple tree problem ...

Subject: RE: [xsl] simple tree problem ...
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Thu, 25 Oct 2001 10:57:20 +0100
> 
> 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 way of doing a breadth-first tree walk is:

<xsl:template match="position">
  <xsl:apply-templates select="child::position" mode="visit"/>
  <xsl:apply-templates select="child::position"/>
</xsl:template>

<xsl:template match="position" mode="visit">
  <xsl:value-of select="."/>
</xsl:template>

Mike Kay 

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


Current Thread