Subject: Re: [xsl] Repeated Recursion on different parts of a tree From: Peter Doggett <ee99ppd@xxxxxxxxxxxx> Date: Thu, 26 Sep 2002 12:22:34 -0400 (EDT) |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Repeated Recursion on dif, David Carlisle | Thread | Re: [xsl] Repeated Recursion on dif, David Carlisle |
Re: [xsl] Re: Selecting a random no, Martin Lormes | Date | RE: Re[2]: [xsl] binary-or, McNally, David |
Month |