Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2008, 12:21 PM
Registered User
 
Join Date: Feb 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Expression must evaluate to a node-set.

Hi,
i am getting the error Expression must evaluate to a node-set. on the following code
oTrans.SelectSingleNode("File/Result").AppendChild(oTemp.SelectSingleNode("//"))

 
Old February 5th, 2008, 01:05 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

I guess you want
  oTemp.SelectSingleNode("//*")
instead of
  oTemp.SelectSingleNode("//")

 
Old February 5th, 2008, 01:17 PM
Registered User
 
Join Date: Feb 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i am getting an error
The node to be inserted is from a different document context.
after i changed like this

oTrans.SelectSingleNode("File/Result").AppendChild(oTemp.SelectSingleNode("//*"))

 
Old February 5th, 2008, 01:27 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

That does not have anything to do with XSLT.
In some DOM implementations you cannot move nodes from one document to another, you need to use ImportNode or AdoptNode.
So assuming you are using the DOM implementation in .NET try
Code:
oTrans.SelectSingleNode("File/Result").AppendChild(oTrans.ImportNode(oTemp.SelectSingleNode("//"), true))
assuming that oTrans is an XmlDocument, or otherwise
Code:
oTrans.SelectSingleNode("File/Result").AppendChild(oTrans.OwnerDocument.ImportNode(oTemp.SelectSingleNode("//"), true))





Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath: set operation with a disjoint node set rich_unger XSLT 7 May 6th, 2008 09:24 AM
substitute text() node value in XPath expression Coolcampers XSLT 4 April 30th, 2008 08:39 AM
Converting String into Node-set dved XSLT 3 January 23rd, 2008 12:40 PM
Filtering out from a node set anothervbaddict XSLT 1 May 22nd, 2007 08:42 AM
node-set function Bernardo Pacheco XSLT 2 June 19th, 2006 10:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.