xsl:for-each and variables

Subject: xsl:for-each and variables
From: "Larry Mason" <Larry_Mason@xxxxxx>
Date: Tue, 14 Dec 1999 17:16:51 -0600

Can anyone tell me why the following will not work?

XML
<data>
<row>1</row>
<row>2</row>
<row>3</row>
<row>4</row>
</data>

XSL
<?xml version="1.0" standalone='no'?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";
  xmlns="http://www.w3.org/TR/REC-html40";
  result-ns="">
 <xsl:variable name="temp">data/row</xsl:variable>
 <xsl:template match="/">
   <xsl:for-each select="data/row">
     value is <xsl:value-of select="."/>
   </xsl:for-each>
   <xsl:for-each select="$temp">
     value is <xsl:value-of select="."/>
   </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

If I take out the second for-each everything works.
When I leave it in, the output says "cannot convert to node-set".  Since the
value of temp is
the same as the static for-each (right?), shouldn't the result be the same?  Any
 work-arounds?

I'm trying to create a template that accepts the tags to process and thus need
the second format.

(using XT from August running on NT using the windows executable)

Any help is GREATLY appreciated.
Larry Mason



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


Current Thread