[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: Thu, 26 Sep 2002 12:22:34 -0400 (EDT)
parts of a tree description
Sorry I should have explained myself better.

If I had an XML document which consisted of many nodes such as:

<register name="DATA" offset="0">
    <no_of_regs>1</no_of_regs>
    <descriptivename>Data register</descriptivename>
    <description>The ...ster.</description>
    <description>In ord..H.</description>
    <description>..Oe...</description>
    <bitfield name="DATA">
      <function>Input data.</function>
      <bitpos>0</bitpos>
      <no_of_bits>10</no_of_bits>
      <initialvalue></initialvalue>
      <accesstype>RW</accesstype>
    </bitfield>
    <bitfield name="Reserved">
      <function>Output data</function>
      <bitpos>10</bitpos>
      <no_of_bits>6</no_of_bits>
      <initialvalue>0</initialvalue>
      <accesstype>RW</accesstype>
    </bitfield>


<register name="CONTROL" offset="20">
.........

I would like to have an output document which will evaluate all of the 
<bitfield> elements for a given register, and give me an expression for 
each register, as one value. 

For example, with one case I would like in 
my output document to have an expression showing the initial value of a 
register. This is evaluated, by a simple algorithm which will shift 
each <bitfield> <initialvalue> (initial value of each individual 
bitfield) by the required <bitpos> (bit position within the register),
with all the bitfields within a simple register having to be evaluated.


So my result document might look like:

Register DATA Initial Value = X
Register CONTROL Initial Value = Y 
etc...

Now I dont have a problem with the maths involved (I am developing 
shifting and decimal to hex/binary templates).The problem is that I 
cant dynamically update a variable in XSL while traversing the tree. to 
call a recursive template would require me to keep track of which 
<bitfield> elements I have processed? 

Any Ideas?








On Wed, 25 Sep 2002 16:33:56 +0100 David Carlisle <davidc@xxxxxxxxx> 
wrote:

> 
> > How would I keep track of the elements I have processed? 
> 
> maybe it's just me not understanding the problem description
> but can't you just use normal tree traversal here
> 
> <xsl:apply-templates/>...
> 
> <xsl:template match="bitfield">
>  <xsl:call-template whatever recursive algorithm you wanted to do...
> 
> maybe it would help if you showed the desired output given your input
> fragment
> 
> 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.