xsl-list
[Top] [All Lists]

RE: Variable select="concat()" not loading variable.

2003-04-24 01:45:11
Hi,

I am trying to concatinate a collection of text() strings 
(see xsl below)
however the variable (timestamps)  is not being filled with 
any data.  Could
someone tell me why?  The total number of timestamps to be 
concatinated is
10,000.

Kind regards

Simon


[code]
<!--
<xsl:for-each select="ROW/TIMESTAMP">
    <xsl:if test="position() = 1">
        <xsl:element name="starttime"><xsl:value-of select="."
/></xsl:element>
    </xsl:if>
    <xsl:if test="position() = last()">
        <xsl:element name="endtime"><xsl:value-of select="."
/></xsl:element>
    </xsl:if>

    <xsl:variable name="timestamps" 
select="concat($timestamps, ./text())"
/>

    <xsl:if test="position() != last()">
        <xsl:variable name="timestamps" 
select="concat($timestamps, $delim)"
/>

XSLT variables cannot be updated--search the list archives for gizillion 
answers on why not. You want something like

<xsl:variable name="x" select="ROW/TIMESTAMP" />
<starttime>
  <xsl:value-of select="$x[1]" />
</starttime>
<endtime>
  <xsl:value-of select="$x[position() = last()]" />
</endtime>
<xsl:variable name="timestamps">
  <xsl:for-each select="$x">
    <xsl:if test="not(position() = 1)">
      <xsl:value-of select="$delim" />
    </xsl:if>
    <xsl:value-of select="text()" />
  </xsl:for-each> 
</xsl:variable>

Cheers,

Jarno - Assemblage 23: Disappoint (Funker Vogt Remix)


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>