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: Thu, 3 Oct 2002 15:53:39 +0100 (GMT Daylight Time)
Thanks Jim.

I have put together a template based on everyones advice.
However when it is called the XSLT processor seems to 
compile indefinately.

Here is the template:

 <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>

the template is called ok, and in the correct part of the 
tree (i can access the required values from the xml when 
the template isnt being recursive). 

also the recursive 
template 'shifter' has also been tested and works 
correctly. the only problem I could think of is the fact 
that each recursive call calls the recursive template 
'shifter', but you guys have just told me this is legal?

It is either that or the 'choose' statement isnt picking up 
the last <bitfield> node (as if i do an always true test I 
get the same compiler lock-up).

Any ideas?



On Mon, 30 Sep 2002 17:30:11 +0100 James Fuller 
<james.fuller@xxxxxxxxxx> wrote:

> > I am aware of the call-template tag.
> > 
> then u must know that you can pass it a parameter.
> > However the issue I have was with the fact that 
> > if I was to call the template by name, how would I deal 
> > with the fact that I want to use the first <bitfield> node, 
> > and then the next and then the next etc.. with each pass of 
> > recursion?
> pass a parameter 
> > 
> > Below it is done by the select attribute, which 
> > <call-template> does not have?
> > Thanks for the book reference. I have just ordered 
> > Michael Kays XSLT Programmers reference, but I may add that 
> > to my shopping list to.
> yes, yes also Jeni Tennison's Beginning XSLT is appropriate.
> gl, jim fuller
>  XSL-List info and archive:

Peter Doggett

 XSL-List info and archive:

Current Thread