views:

412

answers:

2

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?

+1  A: 
  • 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);
dtb
+4  A: 

You can use the XSL function document() in your XSLT to reference an external XML file.

driis
+1. If the input XML files cannot be modified, create a "wrapper" XML document that references all input files using `document()`.
dtb