By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,346 Members | 2,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,346 IT Pros & Developers. It's quick & easy.

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

P: 1
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
Share this Question
Share on Google+
1 Reply


Plater
Expert 5K+
P: 7,872
Is this a runtime error or a build error?
What type of object is Xml1?
Jan 21 '09 #2

Post your reply

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