EDN Admin
Well-known member
Hi,
My code is not working. Basically, I am not sure how to transform a xml that I place in a StringWriter() with another XSLT.
I am not even sure if I should be using a StringWriter(). The error is in the last line of the code.
Please could someone shed some light? Is there a better way of doing it?
Cheers
CP
<pre class="prettyprint protected void Page_Load(object sender, EventArgs e)
{
XslCompiledTransform ConvANCXslt = new XslCompiledTransform();
XsltSettings settings = new XsltSettings();
settings.EnableDocumentFunction = true;
ConvANCXslt.Load(Server.MapPath("XSLT/MasterANC601.xslt"), settings, null);
int sequencialNumber = 0003;
XsltArgumentList argList = new XsltArgumentList();
argList.AddParam("ProcDate", "", DateTime.Now.ToString("yyyyMMdd"));
argList.AddParam("SeqCode", "", sequencialNumber.ToString());
StringWriter MyStringWriter = new StringWriter();
ConvANCXslt.Transform(Server.MapPath("XML/DealList_001.xml"), argList, MyStringWriter);
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(Server.MapPath("XSLT/ANC601.xslt"));
<br/> xslt.Transform(MyStringWriter.ToString(), Server.MapPath("~/ANC601.txt")) ;
} [/code]
<br/>
View the full article
My code is not working. Basically, I am not sure how to transform a xml that I place in a StringWriter() with another XSLT.
I am not even sure if I should be using a StringWriter(). The error is in the last line of the code.
Please could someone shed some light? Is there a better way of doing it?
Cheers
CP
<pre class="prettyprint protected void Page_Load(object sender, EventArgs e)
{
XslCompiledTransform ConvANCXslt = new XslCompiledTransform();
XsltSettings settings = new XsltSettings();
settings.EnableDocumentFunction = true;
ConvANCXslt.Load(Server.MapPath("XSLT/MasterANC601.xslt"), settings, null);
int sequencialNumber = 0003;
XsltArgumentList argList = new XsltArgumentList();
argList.AddParam("ProcDate", "", DateTime.Now.ToString("yyyyMMdd"));
argList.AddParam("SeqCode", "", sequencialNumber.ToString());
StringWriter MyStringWriter = new StringWriter();
ConvANCXslt.Transform(Server.MapPath("XML/DealList_001.xml"), argList, MyStringWriter);
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(Server.MapPath("XSLT/ANC601.xslt"));
<br/> xslt.Transform(MyStringWriter.ToString(), Server.MapPath("~/ANC601.txt")) ;
} [/code]
<br/>
View the full article