Re: [xsl] Repeated Recursion on different parts of a tree

Subject: Re: [xsl] Repeated Recursion on different parts of a tree
From: Peter Doggett <ee99ppd@xxxxxxxxxxxx>
Date: Sat, 5 Oct 2002 15:08:34 +0100 (BST)
Here is a simplified template to illustrate my problem.
When I run the stylesheet I expect to get back the @name of 
each of the <bitfield>'s for every <register>, and then the 
<bitpos> element value of the last <bitfield> node.

Instead, I am getting back, in each case just the @name 
attribute of the first <bitfield> for each <register>.

I have no idea as to why this should be failing. Can anyone 




<xsl:template match="/">

<xsl:for-each select="peripheral/register">

<xsl:call-template name="calcInitialValue3">
                                        <xsl:with-param name="initialValue" select="0" />
                                        <xsl:with-param name="newNode" select="bitfield[1]" />


<xsl:template name="calcInitialValue3">
   <xsl:param name="newNode" />
    <xsl:when test="$newNode/following-sibling::node()">
     <xsl:value-of select="$newNode/@name"/>
     <xsl:call-template name="calcInitialValue">
      <xsl:with-param name="newNode" select="following-sibling::bitfield[1]" />
     <xsl:value-of select="$newNode/bitpos"/> 


A part of my XML:

  <register name="control" offset="0">  
    <bitfield name="DATA">
    <bitfield name="extra">
      <accesstype>read only</accesstype>


On Fri, 4 Oct 2002 16:56:22 +0100 David Carlisle 
<davidc@xxxxxxxxx> wrote:

> > Is there any problems that spring to your mind that I can 
> > explore? 
> not really, as I tried to indicate, if you post more than two lines of
> code it's really quite hard to debug without being able to run it.
> If you can post a stylesheet and some input and say what output you want
> someone (perhaps even me) can probably help. If your shifter template is
> too complicated to post replace it by something else (or nothing) and
> say what output you want to get from that simplified sheet.
> > I mean looking at the choose statement itself, should this 
> > behave as you can see -  by processing up to and including 
> > the last <bitfield> node, and then stopping displaying the 
> > results?
> as I cut the example out of your mail into a stylesheet to try it I
> changed your test from node() to bitfield as that seemed safer (see the
> version I posted) other than that it looks plausible but....
> David
> _____________________________________________________________________
> This message has been checked for all known viruses by Star Internet
> delivered through the MessageLabs Virus Scanning Service. For further
> information visit or alternatively call
> Star Internet for details on the Virus Scanning Service.
>  XSL-List info and archive:

Peter Doggett

 XSL-List info and archive:

Current Thread