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: Fri, 4 Oct 2002 14:17:06 +0100 (BST)
Thanks David. The stylesheet compiles now, but I am still 
not getting a result returned from the template.

Looking at the template it seems that the choose statement 
is not stopping the recursion on the last <bitfield> node,
and so the <choose> conditions are not correct.

Even If I eliminate the arithmetic, It seems the last node 
in which the template switches to the default <otherwise> 
statement and outputs a result, is not the valid last 
<bitfield> node.

I have verified this by changing the <otherwise> statement 
to output just the @name attribute of the current (last) 
node. It returns nothing. Even when I try to output the 
@name of the parent of the last node (or any of its other 
element), on the last pass of recursion, still no value is 

It looks as if the template is going onto a node or part of 
a tree that doesnt exist on the last pass?

I have double checked the statements and all seems to 
conform to the advice I have been given and certain texts. 

My XML and XSL for reference:

 <xsl:template name="calcInitialValue">
  <xsl:param name="initialValue" /> 
  <xsl:param name="newNode" /> 
  <xsl:variable name="bitfieldInitialValue">
   <xsl:call-template name="shifter">
    <xsl:with-param name="Answer"
select="$newNode/initialvalue" /> 
    <xsl:with-param name="decimalBitPos" 
select="$newNode/bitpos" /> 
  <xsl:variable name="newValue" select="$bitfieldInitialValue + $initialValue" /> 
    <xsl:when test="following-sibling::node()">
     <xsl:call-template name="calcInitialValue">
      <xsl:with-param name="initialValue" 
select="$newValue" /> 
      <xsl:with-param name="newNode" 
select="following-sibling::bitfield[1]" /> 
    <xsl:value-of select="$newValue" /> 

A small part of the xml file:

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

Thankyou for your time


On Thu, 3 Oct 2002 16:29:14 +0100 David Carlisle 
<davidc@xxxxxxxxx> wrote:

>     <xsl:when test="following-sibling::node()">
> That's your problem, when you do a call-template the current node
> doesn't change, so you spin here.
> as far as I can see without running it everything is based on your
> newNode param and you want to know if there is something after that so
>   <xsl:when test="$newNode/following-sibling::node()">
> 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