[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Variable with node list...

Subject: RE: Variable with node list...
From: "Oleg Tkachenko" <olegt@xxxxxxxxxxxxx>
Date: Fri, 16 Nov 2001 23:28:50 +0200
reference variable to node set
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.