xsl-list
[Top] [All Lists]

Re: Repeated Recursion on different parts of a tree

2002-10-04 07:33:21
Ok cheers David.

I actually Have a template match to root '/' and then 
within this a <for-each> on all of the register nodes which 
calls the template .

To rule out the possibility of my template being called in 
the wrong place i did a few sanity checks when it was 
called -  like to display the current @name of the register
and also some details of the first Bitfield[1] etc...
(shifter has also been tested independantly and returns 
valid results).

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?

Is there any problems that spring to your mind that I can 
explore? The only conclusive problem that I can see is the 
<choose> statement is not valid, but again I have reviewed 
a lot of material and the conditional statement seems to be 
what I need?


Thankyou 

PD

 



On Fri, 4 Oct 2002 15:06:20 +0100 David Carlisle 
<davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:


My XML and XSL for reference:
It's not enough to go on.
I padded it out to

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">


<xsl:template match="register">
<xsl:call-template name="calcInitialValue">
<xsl:with-param name="newNode" select="bitfield[1]"/>
</xsl:call-template>
</xsl: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:call-template>
  </xsl:variable>
  <xsl:variable name="newValue" select="$bitfieldInitialValue + 
$initialValue" /> 
   <xsl:choose>
    <xsl:when test="following-sibling::bitfield">
     <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>

</xsl:stylesheet>

and got

$ saxon try1.xml try1.xsl
Error at xsl:call-template on line 16 of file:/c:/tmp/try1.xsl:
  No template exists named shifter
Transformation failed: Failed to compile stylesheet. 1 error detected.


at which point I gave up.

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(_at_)brunel(_dot_)ac(_dot_)uk


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