p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   Expression must evaluate to a node-set. (http://p2p.wrox.com/showthread.php?t=65727)

XMLUser February 5th, 2008 12:21 PM

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("//"))


Martin Honnen February 5th, 2008 01:05 PM

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


XMLUser February 5th, 2008 01:17 PM

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("//*"))


Martin Honnen February 5th, 2008 01:27 PM

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))


All times are GMT -4. The time now is 07:43 PM.

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