|
-
May 5th, 2004, 07:02 AM
#1
XSLT.Transform
Hi!
I'm new to XML and XSLT and need to transform some XML into other XML file in a .NET project. I use an XmlTextWriter to output the result. When I call Transform method of the XslTransform I can filter out some data but I don't get the Prolog (XML version="...).
I shouldn't have to do anything with the XmlWriter object between creation and use by the Transform method, should I? If I call WriteStartDocument() and WriteEndDocument() before and after Transformation I get an InvalidOperationException saying:
"Token Content in state Prolog would result in an invalid XML document."
Stack Trace:
at System.Xml.XmlTextWriter.AutoComplete(Token)
at System.Xml.XmlTextWriter.WriteString(String)
at System.Xml.Xsl.WriterOutput.RecordDone(RecordBuilder)
at System.Xml.Xsl.RecordBuilder.TheEnd()
at System.Xml.Xsl.Processor.Execute()
at System.Xml.Xsl.XslTransform.Transform(XPathNavigator, XsltArgumentList, XmlWriter, XmlResolver)
at System.Xml.Xsl.XslTransform.Transform(IXPathNavigable, XsltArgumentList, XmlWriter)
Any ideas what may cause this?
Very greatful for any hints!
Magnus
-
May 5th, 2004, 07:20 AM
#2
If I got you right you should use XmlWriter.WriteProcessingInstruction Method
-
February 3rd, 2011, 10:10 AM
#3
Re: XSLT.Transform
That was the perfect solution. Thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|