Subject: RE: [xsl] Variable with node list... From: "Oleg Tkachenko" <olegt@xxxxxxxxxxxxx> Date: Fri, 16 Nov 2001 23:28:50 +0200 |
Hello Brad! > I get the following error from Microsoft's parser when processing the > included document and stylesheet. That parser is probably right :) <xsl:for-each> needs node-set to iterate through, whereas you give it result tree fragment instead. > > Reference to variable or parameter 'properties' must evaluate to a node > list. > > Has anyone else run across this? (MSXML3, IE6, Windows 2000 Server) Yeah, it seems to me all of us have to try to do it once in the life. > <xsl:variable name="properties"> > <property>one</property> > <property>two</property> > <property>three</property> > </xsl:variable> This variable actually holds result tree fragment, not node-set, see http://www.w3.org/TR/xslt#section-Result-Tree-Fragments. I know 2 ways to resort: 1. use msxsl:node-set(rtf) extension function (see more in msxml doc) to convert result tree fragment to node-set. 2. Redesign you stylesheet this way: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:user="http://user.com/ns"> <user:properties> <property>one</property> <property>two</property> <property>three</property> </user:properties> <xsl:template match="root"> <foo> <xsl:for-each select="document('')/*/user:properties/property"> <bar> <xsl:value-of select="."/> </bar> </xsl:for-each> </foo> </xsl:template> </xsl:stylesheet> --- Oleg Tkachenko, Multiconn International, Israel XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl]&ndash problem and netscap, Jeni Tennison | Thread | RE: [xsl] Variable with node list.., Michael Kay |
[xsl] the last substring, yan bai | Date | RE: [xsl] xslt on server-side vs. c, Hunsberger, Peter |
Month |