XSLT transform with multiple XML input files
-
20-09-2019 - |
Question
Is it possible to perform a transform on multiple input XML files?
It doesn't appear to be possible using XslCompiledTransform
, but is there an alternative way of applying an XSLT?
Solution
You can use the XSL function document() in your XSLT to reference an external XML file.
OTHER TIPS
Apply the transformation to each input XML file individually and compose the resulting XML documents into a single document.
Compose the input XML files into a single document and apply the transformation, e.g.
XElement root = new XElement("root", XElement.Load("file1.xml"), XElement.Load("file2.xml"), XElement.Load("file3.xml")); XslCompiledTransform transform; transform.Transform(root.CreateReader(), output);
With XSL function some security settings are necessary in C#. I believe this is the correct solution:
<xsl:include href="Filename"/>
This method handles multiple files.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow