[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Variable with node list...
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|