Hi,
This is my first posting,
1. From C# i want to create a new XSL
2 . can i append XSL file fromm C# , is it possible
if so how can any one hep me out
thanks
Radhkrishnan.K
Hi,
This is my first posting,
1. From C# i want to create a new XSL
2 . can i append XSL file fromm C# , is it possible
if so how can any one hep me out
thanks
Radhkrishnan.K
Dynamic creation of XSLT from C#
J.H
XSL file is an XML document.
You can edit it as any other XML -- read and write with XmlTextReader/XmlTextWriter or load it to XmlDocument and alter node by node. You can load it to XPathDocument and run another XSL transformation to transform XSL to XSL.
The same time it is a text so you free to open it as a text file and change it char by char.
I don't understand part of question: "some operation finally the original XSL should be there in my server".
kurra kiran
Vayse
thanks for your reply,
Dynamically i want to alter the XSL file
or i have to create the XSL file, that is my requirement,
because I am converting one form of XML to another form of XML using XSL,C#,
the source XML dymanically i am creating from my C# emvironment, so i want to alter the XSL according to that,
I hope you understand my requirement.
Thanks
Radhakrishnan.K
jcwishart
a XSLT stylesheet is an xml file. If you need to dynamically create one in memory you can use the XMLDocument class. Or if you need to modify an existing one, load it into the XMLDocument class and change it in there.
When it comes to running the XSLT transformation you'll need to save to file, and then reload the file (unless there is an overload of the Transform method that accepts XML as a string).
cehagema
Hi, thnaks for your reply,
While tranform the XML using xslt, can i store it to an object /
my code look like this
ContentMLMapppingFilePath = @"..\\..";
ContentMLMapppingFileName = @"ContentMLMapping.xsl";
string ContentMLfileName = string.Empty;ContentMLfileName = ContentMLMapppingFilePath +"\\" + ContentMLMapppingFileName;
XslTransform objXslTransform =
new XslTransform(); objXslTransform.Load(ContentMLfileName); XPathDocument objXPathDocument = new XPathDocument(NtmMLfileName); XsltArgumentList objXsltArgumentList = new XsltArgumentList();Mapping objMapping =
new Mapping();objXsltArgumentList.AddExtensionObject("urn:myObj", objMapping);
string contentMLFileName = @"..\\..\\ContentMLSample.xml";XmlTextWriter objXmlTextWriter =
new XmlTextWriter(contentMLFileName,null); objXslTransform.Transform(objXPathDocument, objXsltArgumentList,objXmlTextWriter, null);objXmlTextWriter.Close();
once run this it tranforms into and XML file called ContentMLSample.xml
i want to store this transformation output into an object not a file,
I tried using the return type as xml reader, it is giving error can you suggest me
RS_babu
Hi,
I have a requirement, i have to alter my XSL file from C#,
After alteration, i am going to do XML tranformation.
How do i alter the XSL file using C#,
after alteration i 'll do some operation finally the original XSL should be there in my server.
Can anyone help me to solve this problem with example please...
Radhakrishnan.K
Sandeep Prabhakar
Hi,
i found the answer....
Thanks for all
Radhakrishnan.k
Waldsee
You can write and append to this file as in any other file.
Sergey
Diego Canepa
Hi,
i tried the way you are telling, it is giving error, can you explain with an example.
Just alter the xsl file from C# end(This alone)
after alteration happing tranfrorm to another form of XML(This i know)
Thanks
Radhakrishnan.K