[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Repeated Recursion on different parts of a tree

Subject: Re: Repeated Recursion on different parts of a tree
From: Peter Doggett <ee99ppd@xxxxxxxxxxxx>
Date: Fri, 4 Oct 2002 14:17:06 +0100 (BST)
4 parts of a tree
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 
returned.

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:call-template>
  </xsl:variable>
  <xsl:variable name="newValue" select="$bitfieldInitialValue + $initialValue" /> 
   <xsl:choose>
    <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:call-template>
    </xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="$newValue" /> 
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>




A small part of the xml file:


  <register name="control" offset="0">
    <no_of_regs>1</no_of_regs>  
    
    <bitfield name="DATA">
      <function>xxxxxx</function>
      <bitpos>0</bitpos>
      <no_of_bits>10</no_of_bits>
      <initialvalue>5</initialvalue>
      <accesstype>readonly</accesstype>
    </bitfield>
    <bitfield name="extra">
      <function>........</function>
      <bitpos>8</bitpos>
      <no_of_bits>4</no_of_bits>
      <initialvalue>1</initialvalue>
      <accesstype>read only</accesstype>
    </bitfield>    
  </register> 
 ..........
............ 
 



Thankyou for your time



Peter.





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 http://www.star.net.uk/stats.asp or alternatively call
> Star Internet for details on the Virus Scanning Service.
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

----------------------
Peter Doggett
ee99ppd@xxxxxxxxxxxx


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.