I have the following code: I'm using an xml Document and trying to apply an XSLT document to it to give me a new document. I receive an error stating that I need to set the conformance level. When I set the conformance level, I receive an error stating that
the conformance level is read only even though the tooltip states it's a getter and setter.
billcrawley
Member
341 Points
286 Posts
Cant set conformance level
Nov 26, 2012 07:30 AM|LINK
Hi All,
I have the following code: I'm using an xml Document and trying to apply an XSLT document to it to give me a new document. I receive an error stating that I need to set the conformance level. When I set the conformance level, I receive an error stating that the conformance level is read only even though the tooltip states it's a getter and setter.
string fileToSave = string.Concat(directory, @"\", client.ClientID, "Summary.html"); XmlDocument doc = new XmlDocument(); doc.LoadXml(MagnumLog); XPathDocument xslDoc = new XPathDocument(Template); XslCompiledTransform xslt = new XslCompiledTransform(); xslt.OutputSettings.ConformanceLevel = ConformanceLevel.Auto; xslt.Load(xslDoc); XmlWriter writer = XmlWriter.Create(fileToSave); xslt.Transform(doc, writer);DarrellNorto...
All-Star
86645 Points
9629 Posts
Moderator
MVP
Re: Cant set conformance level
Nov 26, 2012 09:13 AM|LINK
You need to set the conformance level on the XmlWriter, not the XslCompiledTransform, like this:
Darrell Norton's Blog
Please click "Mark as Answer" if this helped you.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Cant set conformance level
Nov 27, 2012 12:26 AM|LINK
Hello,
Since the problem is solved, I'll mark the MVP as an answer to close the issue. Welcome your futher feedback.
Reguards!