I have a case where a user uploads an XML file. I am using XDocument to handle it. However, I want to replace the stylesheet used with one on the server. Is there a way to use XDocument to modify the
I can get the expression with linq, as an XmlNode, as shown below:
var node = from proc in doc.Nodes()
where proc.NodeType == XmlNodeType.ProcessingInstruction
select proc;
But I cannot figure out how to replace the node.
Update: I feel like an idiot...
var node = doc.Nodes().Where(type => type.NodeType == System.Xml.XmlNodeType.ProcessingInstruction).Single() as XProcessingInstruction;
node.Data = "href=\"" + Utilities.Utility.XSLLocation + "\" type=\"text/xsl\"";