xsl-list
[Top] [All Lists]

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

2003-04-24 02:37:39

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.

You are trying to assign to a variable. Basic error - that's not how
variables in XSLT work. It's not a procedural language like JavaScript.
Read any number of posts about variable assignment, procedural vs
declarative programming, etc, or any XSLT textbook.

You want something like:

<xsl:variable name="timespamps">
  <xsl:for-each select="....">
     <xsl:value-of select="."/>
  </xsl:for-each>
</xsl:variable>

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


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)" />
    </xsl:if>
 </xsl:for-each>
-->

"Make it idiot proof, and someone
 will make a better idiot" - Anon

Institut fuer
Prozessdatenverarbeitung
und Elektronik,
Forschungszentrum Karlsruhe GmbH,
Postfach 3640,
D-76021 Karlsruhe,
Germany.

Tel: (+49)/7247 82-4042
E-mail : kelly(_at_)ipe(_dot_)fzk(_dot_)de


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



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



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