Subject: Re: [xsl] xsl recursion From: Norman Barker <normanb@xxxxxxxxxxxxx> Date: Wed, 23 Feb 2005 21:10:07 +0000 |
My apologies, wasn't aware of the cross post, I waited all afternoon for my message to appear in comp.text.xml, it didn't so I posted to mulberry (check the times if you don't believe me!). I was trying to do an algorithm with an XML fragment (since I am using SAX withing Cocoon) so /*/* won't work in my case, I will try with the stop position you suggest. Thanks for all your help, and apologies about the cross post. Norman On Thu, 2005-02-24 at 07:40 +1100, Dimitre Novatchev wrote: > There's no need for recursion and therefore for DVC here: > > <xsl:template match="/"> > <xsl:for-each select="/*/*"> > <xsl:value-of select= > "concat(col2 - col1, '
')"/> > </xsl:for-each> > </xsl:template> > > > > > > On Wed, 23 Feb 2005 15:46:14 +0000, Norman Barker <normanb@xxxxxxxxxxxxx> wrote: > > Hi, > > I am using Xalan and Cocoon to doing try and implement a "divide and > > conquer" algorithm for processing very > > large XML files. I have a row count of 8400, so I should only have a > > depth of log2(8400) (about 12), I keep getting > > stack overflow error, and setting -RL with Xalan fails too, I thought > > DVC algorithms were supposed to stop this! > > > > Anyway, > > > > <sql:rowset> > > <sql:row> > > <col1>..</col1> > > <col2>..</col2> > > </sql:row> > > : > > : > > </sql:rowset> > > > > and the template looks like > > where rows are the collection of sql:row above > > Any help would be great, thanks, > > > > <xsl:template name="data"> > > <xsl:param name="rows"/> > > <xsl:param name="rowcount" select="count($rows)"/> > > <xsl:choose> > > <xsl:when test="$rowcount = 1"> > > <xsl:for-each select="sql:row"> > > <xsl:for-each select="*"> > > <xsl:choose> > > <xsl:when test="(local-name(.) = 'date') or > > (local-name(.) = 'lat') or (local-name(.) = 'lon')"></xsl:when> > > <xsl:otherwise> > > <xsl:value-of select="."/> > > </xsl:otherwise> > > </xsl:choose> > > </xsl:for-each> > > </xsl:for-each> > > </xsl:when> > > <xsl:otherwise> > > <xsl:variable name="cntHalf" > > select="floor($rowcount div 2)"/> > > > > <xsl:variable name="vValue1"> > > <xsl:call-template name="data"> > > <xsl:with-param name="rows" > > select="$rows[position() <= $cntHalf]"/> > > </xsl:call-template> > > </xsl:variable> > > > > <xsl:variable name="vValue2"> > > <xsl:call-template name="data"> > > <xsl:with-param name="rows" > > select="$rows[position() > $cntHalf]"/> > > </xsl:call-template> > > </xsl:variable> > > </xsl:otherwise> > > </xsl:choose> > > </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl recursion, Dimitre Novatchev | Thread | Re: [xsl] xsl recursion, Dimitre Novatchev |
RE: [xsl] lookup table keyed by pos, Michael Kay | Date | [xsl] TD and input box values in XS, Adam_Wetch |
Month |