Hai how to add a tag in a start and tag in end tag textwriter? Thanx
+1
A:
Use an XmlWriter
. Write your starting root element. Then pass the XmlWriter
to the XSL transform. It will continue writing. When that's done, write your end root element:
public static void WrapTransform(
Stream outputStream,
string styleSheetUri,
string documentUri)
{
var transform = new XslCompiledTransform();
using (var styleSheetReader = XmlReader.Create(styleSheetUri))
{
transform.Load(styleSheetReader);
}
using (var wrapper = XmlWriter.Create(outputStream))
{
wrapper.WriteStartElement("Root");
transform.Transform(documentUri, wrapper);
wrapper.WriteEndElement();
}
}
John Saunders
2009-10-30 01:37:38
Hai John,thanks for your answer.This is what i have now.So How to get a XmlDocument out of this xmlwriter? XmlWriter xmlwriter=XmlWriter.Create(stream1); xmlwriter.WriteStartElement("Root"); xslTrans.Transform(xPathDoc1, null, xmlwriter); xmlwriter.WriteEndElement();Thanks
Kaja
2009-10-31 13:14:17
Hai i solved the problem.Thanks for the answer given by John Saunders
Kaja
2009-10-31 13:40:42
Great. How did you solve it?
John Saunders
2009-11-01 02:21:36
Hai John, i solved with ur answer..thts the 1 needed 4 me..thnx.
Kaja
2009-11-01 13:53:31