473,796 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Xml.Xsl. XsltException: Cannot convert the operand to 'Result tree fragment'.

1 New Member
Hi,
This is Parthy.

Am getting this error in XSLT.

Am trying to search the rows by passing parameter from C# 2.0 to XSLT.

Can anyone give me a solution for this prob...

The coding follows:

CS Page:-

Expand|Select|Wrap|Line Numbers
  1. XsltArgumentList xslArg = new XsltArgumentList();
  2.         xslArg.AddParam("firstName", "", txtCustomerName.Text);
  3.  
  4.  
  5.         string xmlPath = @"D:\Project\Parthy\XML_Samples\XML_XSLT\OrdersXML.xml";
  6.         ds.WriteXml(xmlPath);
  7.  
  8.  
  9.         Xml1.TransformSource = @"D:\Project\Parthy\XML_Samples\XML_XSLT\SearchXSL.xsl";
  10.         Xml1.TransformArgumentList = xslArg;
  11.         Xml1.DocumentSource = xmlPath;
  12.         Xml1.DataBind();



XSLT :

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <xsl:stylesheet version="1.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4. xmlns:exsl="urn:schemas-microsoft-com:xslt"
  5.   extension-element-prefixes="exsl">
  6.  
  7.   <xsl:param name="firstName" select="//Table"/>
  8.  
  9.   <xsl:template match="/">
  10.  
  11.     <html>
  12.       <body>
  13.         <h2>Orders</h2>
  14.         <table border="1">
  15.           <tr bgcolor="blue">
  16.             <th align="center">Order No</th>
  17.             <th align="center">Order Date</th>
  18.             <th align="center">First Name</th>
  19.             <th align="center">Last Name</th>
  20.             <th align="center">Order Amount</th>
  21.             <th align="center">Shipping Charge</th>
  22.             <th align="center">Shipping Service</th>
  23.             <th align="center">Payment Type</th>
  24.             <th align="center">Payment Status</th>
  25.             <th align="center">Order Status</th>
  26.             <th align="center">Phone Verify</th>
  27.           </tr>
  28.  
  29.           <xsl:for-each select="exsl:node-set($firstName)/First_x0020_Name">
  30.             <tr>
  31.               <td>
  32.                 <xsl:value-of select="Order_x0020_No"/>
  33.               </td>
  34.               <td>
  35.                 <xsl:value-of select="Order_x0020_Date"/>
  36.               </td>
  37.               <td>
  38.                 <xsl:value-of select="First_x0020_Name"/>
  39.               </td>
  40.               <td>
  41.                 <xsl:value-of select="Last_x0020_Name"/>
  42.               </td>
  43.               <td>          
  44.                 <xsl:value-of select="Order_x0020_Amount"/>
  45.               </td>
  46.               <td>
  47.                 <xsl:value-of select="Shipping_x0020_Charge"/>
  48.               </td>
  49.               <td>
  50.                 <xsl:value-of select="Payment_x0020_Type"/>
  51.               </td>
  52.               <td>
  53.                 <xsl:choose>
  54.                   <xsl:when test="./Payment_x0020_Status=&quot;Y&quot;">
  55.                     <span style="color:red">
  56.                       <xsl:value-of select="Payment_x0020_Status"/>
  57.                     </span>
  58.                   </xsl:when>
  59.                   <xsl:otherwise>
  60.                     <span style="color:green">
  61.                       <xsl:value-of select="Payment_x0020_Status"/>
  62.                     </span>
  63.                   </xsl:otherwise>
  64.                 </xsl:choose>
  65.  
  66.               </td>
  67.               <td>
  68.                 <xsl:value-of select="Order_x0020_Status"/>
  69.               </td>
  70.               <td>
  71.                 <xsl:value-of select="Phone_x0020_Verify"/>
  72.               </td>
  73.             </tr>
  74.           </xsl:for-each>
  75.         </table>
  76.       </body>
  77.     </html>
  78.   </xsl:template>
  79.  
  80. </xsl:stylesheet>
Jan 19 '09 #1
1 2849
Plater
7,872 Recognized Expert Expert
Is this a runtime error or a build error?
What type of object is Xml1?
Jan 21 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
4965
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
2
2066
by: one | last post by:
Hi, can some experts out there tell me why I am getting: An unhandled exception of type 'System.Xml.Xsl.XsltException' occurred in system.xml.dll... (No details in the error dialog box) FileStream fs = new FileStream("test.xml",FileMode.OpenOrCreate); StreamReader sr = new StreamReader(fs); XmlTextReader xtr = new XmlTextReader(sr); XmlDocument xd = new XmlDocument(); xd.Load(xtr); XmlElement root = xd.DocumentElement;...
5
4213
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple values in the where clause as below
3
3645
by: Eugen Gulinsky | last post by:
Hello guys, I am having problems trying to migrate our MSXML4-compatible stylesheets containing large msxsl:script blocks to a formate understandable by System.Xml:Xsl.XslTransform. I keep getting JS1135 errors saying that some variable was not declared. This scripts worked perfectly with MSXML4. Is there a guide for migraiton from MSXML to .NET or can you just give me some tips on how to resolve this issues without having to change...
2
3722
by: KJS | last post by:
Hello, I'm receiving: 'System.Xml.Xsl.XsltException: Missing mandatory attribute 'version' After I try and run my transformation. I spent a good few days coming up with the appropriate (I think) methods, and overrides for this task. I have verified that the source XML and XSL will transform by means of using the MSXML command line parsing tool (previous version of MSXML though). Here is my code:
3
13012
by: Imran Aziz | last post by:
Hello All, I am getting the following error on our production server, and I dont get the same error on the development box. Unable to cast object of type 'System.Byte' to type 'System.String'. here is the code that I used to create a table and then add columns to it later, later I populate the rows in the table.
19
2515
by: Rajesh S R | last post by:
Consider the following code: int main() { struct name { long a; int b; long c; }s={3,4,5},*p; p=&s;
7
5049
by: somenath | last post by:
Hi All, I am trying to undestand "Type Conversions" from K&R book.I am not able to understand the bellow mentioned text "Conversion rules are more complicated when unsigned operands are involved. The problem is that comparisons between signed and unsigned values are machine- dependent, because they depend on the sizes of the various integer types. For example, suppose that int is 16 bits
2
2231
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why does 1+1 equal 11? or How do I convert a string to a number? ----------------------------------------------------------------------- Javascript variables are loosely typed: the conversion between a string and a number happens automatically. Since plus (+) is also used as in string concatenation, ` '1' + 1 ` is equal to ` '11' `: the String deciding...
2
2870
by: JamesDelaney | last post by:
Hi all, I'm creating a number of fragments to calculate various presence numbers. I'm creating variables from the results of these fragments then doing simple math to give the results. I'm having an error when trying to add two variables (from the result-tree-fragment) when one variable has no value at all. In the source XML, the criteria returns no matches, so when the two variables are added, it returns NaN. I'm Trying to make a...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9533
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.