I have an XML file that already contains a reference to an XSLT file.
I'm looking at converting this XML file, according to the referenced transformation rules, so that I can then create a nice PDF file.
It appears that I can perform the actual transform via System.Xml.Xsl.XslCompiledTransform
, but it requires that I manually associate an XSLT before I perform the transform.
Based on what I've seen, I must now manually pull the XSLT reference from the XDocument (rough start below):
xmlDocument.Document.Nodes()
.Where(n => n.NodeType == System.Xml.XmlNodeType.ProcessingInstruction)
However, since the XSLT is already referenced within the XML file itself, I assume I'm doing too much work, and there's a more efficient way to apply the transform.
Is there, or is this what one has to do?