Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Divide and Conquer XSL

Thread Tools

Divide and Conquer XSL

Norman Barker
Posts: n/a

I am trying to use the DVC algorithm detailed at

had a few problems, the document is structured as

where YYYYMMDD is a valid xsd:datetime, there are thousands of
these rows, so using a for-each is a bit slow, eventually I want
to compare two times (the current time and the preceding time),
to produce a document consisting of <difference> elements where
the value is the difference in the times.

Using a simple recursive template also causes a stack overflow
with Xalan (known error).

My implementation of DVC is as below, and it should work but it
also causes a stack overflow! My questions are what is wrong
,and will the DVC result when doing differencing compare 2
adjcent nodes?

<xsl:template name="timesteps">
<!-- rows is the set of sql:row -->
<xslaram name="rows"/>
<xslaram name="rowcount" select="count($rows)"/>
<xsl:when test="$rowcount = 2">
<!-- print out 2 times, will print out date difference
when this eventually works -->
<xsl:copy-of select="$rows[1]"/>
<xsl:copy-of select="$rows[2]"/>
<xsl:variable name="cntHalf"
select="floor($rowcount div 2)"/>

<xsl:variable name="vValue1">
<xsl:call-template name="timesteps">
<xsl:with-param name="rows"
select="$rows[position() &lt;= $cntHalf]"/>

<xsl:variable name="vValue2">
<xsl:call-template name="timesteps">
<xsl:with-param name="rows"
select="$rows[position() > $cntHalf]"/>


Many thanks,

Norman Barker
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft on Linux: Divide and Conquer Mickey Mouse NZ Computing 20 05-29-2007 10:03 PM
Divide and conquer problem urvi C Programming 1 10-28-2005 10:58 PM
Conquer Online Jay NZ Computing 2 07-13-2005 12:56 AM
command and conquer CHAS Computer Support 2 09-24-2003 02:08 PM
command and conquer generals mark hey Computer Support 1 08-19-2003 07:54 PM