473,322 Members | 1,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

parameter evaluates not to a node list

When I run this XSL with IE6 then I get following
error: "Reference to variable or parameter 'myset'
must evaluate to a node list." Why is 'myset' not
a node list?

How can this easely be solved?

---- XML file ---

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="test.xsl" type="text/xsl"?>
<root>
</root>

--- XSL file ---

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" version="1.0"/>

<xsl:template match="/">

<xsl:variable name="myset">
<test>
</test>
</xsl:variable>

<xsl:value-of select="count($myset)"/>

</xsl:template>
</xsl:stylesheet>

Jun 14 '06 #1
2 2719


Paul Verbelen wrote:
When I run this XSL with IE6 then I get following
error: "Reference to variable or parameter 'myset'
must evaluate to a node list." Why is 'myset' not
a node list? <xsl:variable name="myset">
<test>
</test>
</xsl:variable>

<xsl:value-of select="count($myset)"/>


Unfortunately XSLT 1.0 distinguishes between the data model for input
XML and result XML and your variable defines a result tree fragment on
which you can do e.g.
<xsl:copy-of select="$myset" />
but on which you can't apply the full XPath set of operations.

One way to solve that is to use an extension function, MSXML 3 and later
support one so you can do e.g.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">

<xsl:output method="xml" version="1.0"/>

<xsl:template match="/">

<xsl:variable name="myset">
<test>
</test>
</xsl:variable>

<xsl:value-of select="count(msxsl:node-set($myset))"/>

</xsl:template>
</xsl:stylesheet>

But obviously that approach is not portable as that extension function
namespace is Microsoft specific. Most XSLT processors by now provide a
similar extension function. Others do not.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 14 '06 #2
Paul Verbelen wrote:
<xsl:variable name="myset">
<test>
</test>
</xsl:variable>

<xsl:value-of select="count($myset)"/>


You have put a Result Tree Fragment into the variable. Unfortunately, in
XSLT 1.0, RTFs are not nodesets and can't be navigated as trees. (XSLT
2.0 fixes this by replacing the concept of RTFs with "temporary trees").

The standard workaround for 1.0 is to use the EXSLT extension function
node-set(), if your processor supports it. (Most do, these days.)

http://www.exslt.org/exsl/functions/node-set/
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Olivier Boudeville | last post by:
Hi all, it must be a very stupid question but I cannot find out the explanation for my code's behaviour, so any help would really be appreciated. My purpose was, simply put, to have a...
3
by: Seung-Uk Oh | last post by:
Hi, everyone! We are developing an application using both C and C++. We have defined a structure in a C program as follows: typedef struct node { struct node *next; int value; }List;
10
by: Fabio | last post by:
Hi everyone, Is there anybody who can suggest me a link where I can find information about 'Persistent linked list' ? I need to implement a linked list where every node is a structure like the...
4
by: Dave | last post by:
Hello all, I hope the context to my problem shown below is adequate but not overwhelming. I tried to keep it minimal. At the line indicated (in comment form) in the source below, the...
18
by: hzmonte | last post by:
typedef int t_compare_func(const void *, const void *); struct node *tree_search(struct node *root, const void *keyy, t_compare_func *comp) { struct node *cur_item; int result; if (root ==...
4
by: sam | last post by:
I use a List<Tand the method FindLastIndex like this: List<XmlNodeListArticle; int iIndex = ListArticle.FindLastIndex(TheSameYear); .... private bool TheSameYear(XmlNode n) { if(....) return...
2
by: Reza Amiri | last post by:
Hi, I have designed a linked list with an Iterator to access the nodes of this list in C++. When I call a section of my code that exercises the remove I get garbages in the fuction call parameter....
6
by: humblemark | last post by:
Hello, I try to give a parameter in the function tt; but omething went wrong?? Any idea what i can do?? int ret_integer() { return 76;
10
by: Aditya | last post by:
Hi All, I would like to know how it is possible to insert a node in a linked list without using a temp_pointer. If the element is the first element then there is no problem but if it is in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.