[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
Here is a simplified template to illustrate my problem. When I run the stylesheet I expect to get back the @name of each of the <bitfield>'s for every <register>, and then the <bitpos> element value of the last <bitfield> node. Instead, I am getting back, in each case just the @name attribute of the first <bitfield> for each <register>. I have no idea as to why this should be failing. Can anyone help? Thanks. My XSL: //----------------------------------------------------------------- <xsl:template match="/"> <xsl:for-each select="peripheral/register"> <xsl:call-template name="calcInitialValue3"> <xsl:with-param name="initialValue" select="0" /> <xsl:with-param name="newNode" select="bitfield[1]" /> <\xsl:call-template> ........... ...... <xsl:template name="calcInitialValue3"> <xsl:param name="newNode" /> <xsl:choose> <xsl:when test="$newNode/following-sibling::node()"> <xsl:value-of select="$newNode/@name"/> <xsl:call-template name="calcInitialValue"> <xsl:with-param name="newNode" select="following-sibling::bitfield[1]" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$newNode/bitpos"/> </xsl:otherwise> </xsl:choose> </xsl:template> //------------------------------------------------------- A part of my XML: <register name="control" offset="0"> <no_of_points>1</no_of_points> <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> .......... ............ //------------------------------------------------------------ On Fri, 4 Oct 2002 16:56:22 +0100 David Carlisle <davidc@xxxxxxxxx> wrote: > > > Is there any problems that spring to your mind that I can > > explore? > > not really, as I tried to indicate, if you post more than two lines of > code it's really quite hard to debug without being able to run it. > > If you can post a stylesheet and some input and say what output you want > someone (perhaps even me) can probably help. If your shifter template is > too complicated to post replace it by something else (or nothing) and > say what output you want to get from that simplified sheet. > > > > 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? > > as I cut the example out of your mail into a stylesheet to try it I > changed your test from node() to bitfield as that seemed safer (see the > version I posted) other than that it looks plausible but.... > > 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|