Hi,
I am trying to use the DVC algorithm detailed at
had a few problems, the document is structured as
:
:
<sql:row>
<sql:date>YYYYM MMDD</sql:date>
</sql:row>
<sql:row>
<sql:date>YYYYM MMDD</sql:date>
</sql:row>
:
:
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 -->
<xsl:param name="rows"/>
<xsl:param name="rowcount" select="count($ rows)"/>
<xsl:choose>
<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:when>
<xsl:otherwis e>
<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() <= $cntHalf]"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="vValue2">
<xsl:call-template name="timesteps ">
<xsl:with-param name="rows"
select="$rows[position() > $cntHalf]"/>
</xsl:call-template>
</xsl:variable>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Many thanks,
Norman Barker
I am trying to use the DVC algorithm detailed at
had a few problems, the document is structured as
:
:
<sql:row>
<sql:date>YYYYM MMDD</sql:date>
</sql:row>
<sql:row>
<sql:date>YYYYM MMDD</sql:date>
</sql:row>
:
:
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 -->
<xsl:param name="rows"/>
<xsl:param name="rowcount" select="count($ rows)"/>
<xsl:choose>
<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:when>
<xsl:otherwis e>
<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() <= $cntHalf]"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="vValue2">
<xsl:call-template name="timesteps ">
<xsl:with-param name="rows"
select="$rows[position() > $cntHalf]"/>
</xsl:call-template>
</xsl:variable>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Many thanks,
Norman Barker