This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Repeated Recursion on different parts of a tree
- From: Peter Doggett <ee99ppd at brunel dot ac dot uk>
- To: XSL-List at lists dot mulberrytech dot com
- Date: Wed, 25 Sep 2002 16:00:19 -0400 (EDT)
- Subject: [xsl] Repeated Recursion on different parts of a tree
- Reply-to: xsl-list at lists dot mulberrytech dot com
I am quite familiar with recursive processing in
XSL, and its use as a 'replacement' to variables that cant be
redifined. However I have come across a problem
I cant seem to solve and was wondering if anyone could help me?
Basically I have the following XML code:
<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>0</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>
etc..........
</register>
<register name="SWAP" offset="10">
<no_of_regs..........
It is used for a hardware project I am working on at university. I want to
do do some arithmetic and bitwise operations
on each bitfield <initialValue> element, and its <bitpos> element.
(What I hope to achieve is -
using all of the bitfields correctly together to describe the whole
register in my output document)
Now I know recursively I can 'update a variable' with the bitfield
information I need. However, when traversing my XML, how can I keep a
record of what values I have processed
in the tree. For example If I have recursively called a template to
process <bitfield name="DATA">, when the template is recalled recursively,
how do I get it to now work on <bitfield name="Reserved">, and then the
node after that etc ?
How would I keep track of the elements I have processed?
Thankyou very much for your time
----------------------
Peter Doggett
ee99ppd@brunel.ac.uk
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list