|
Subject: Re: [xsl] for-each issue From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Thu, 27 Mar 2008 16:02:03 +0530 |
On 3/27/08, Z W <mpc8250@xxxxxxxxx> wrote:
> <td>
> <xsl:variable name="cib_time_duration">
> <xsl:for-each select="document($currentJTL)/testResults/*[not(@label =
> preceding::*/@label)]">
> <xsl:variable name="minTimeStamp_prev_2">
> <xsl:call-template name="find_minTimeStamp_prev_2"> <xsl:with-param
> name="nodes" select="/testResults/sampleResult" />
> </xsl:call-template>
> </xsl:variable>
>
> <xsl:variable name="maxTimeStamp_prev_2">
> <xsl:call-template name="find_maxTimeStamp_prev_2">
> <xsl:with-param name="nodes" select="/testResults/sampleResult" />
> </xsl:call-template>
> </xsl:variable>
>
> <xsl:variable name="timeSpan" select="$maxTimeStamp_prev_2
> -$minTimeStamp_prev_2" />
> <xsl:value-of select="$timeSpan"/>
> </xsl:for-each>
> </xsl:variable>
>
> <xsl:value-of select="$cib_time_duration"/>
>
> </td>
>
> But I get the $cib_time_duration printed 3 times. How do I get it to
> print once ?
This might solve the problem
<xsl:variable name="cib_time_duration">
<xsl:for-each select="document($currentJTL)/testResults/*[not(@label =
preceding::*/@label)]">
<!-- keep the code here
as it is
-->
<xsl:if test="position() = last()">
<xsl:value-of select="$timeSpan"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="$cib_time_duration" />
Though I have a feeling, you can structure the code even better.
--
Regards,
Mukul Gandhi
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] for-each issue, Z W | Thread | Re: [xsl] for-each issue, Z W |
| Re: [xsl] Modification to The CSV t, Manfred Staudinger | Date | Re: [xsl] for-each issue, Z W |
| Month |