Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

Normally we can pass the XML path as param for XSLT and we can render an HTML as out put

.In this case Template are designed in a way that its calling with param key of that XML.

My requirement is to pass the XML itself as param instead of path .Is it Possible?

Please see the code
------------------------------------------------------------------------------------
XslCompiledTransform myXslTransform;
myXslTransform = new XslCompiledTransform();
XslTransform mytransform = new XslTransform();
System.Xml.Xsl.XsltSettings mySettings;
mySettings = new System.Xml.Xsl.XsltSettings();
XmlUrlResolver xmlresolve = new XmlUrlResolver();
XsltArgumentList argsList;
argsList = new XsltArgumentList();
DataTable dt = GetXml();
argsList.AddParam("POF", "", dt.Rows[0]["Xml"].ToString().TrimEnd());
argsList.AddParam("BSF", "", dt.Rows[1]["Xml"].ToString().TrimEnd());
//argsList.AddParam("POF", "", ((Server.MapPath("~/POTEP.xml")).ToString()));
//argsList.AddParam("BSF", "", ((Server.MapPath("~/TEPBS2.xml")).ToString()));
mySettings.EnableDocumentFunction = true;


myXslTransform.Load((Server.MapPath("~/PoPrint3clean.xsl")).ToString(), mySettings, xmlresolve);

using (StreamWriter sw = new StreamWriter(Server.MapPath("~/Test3.html").ToString()))
{

//myXslTransform.Transform(dt.Rows[0]["Xml"].ToString(), argsList, sw);
myXslTransform.Transform(Server.MapPath("~/POTEP.xml").ToString(), argsList, sw);
---------------------------------------------------------------------------------

What I have tried:

While we giving XMl as path the code is working.If we taking XMl value dynamically from table and giving its not accepting in XSLT
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900