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?

3 Answers 3

5

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

Sign up to request clarification or add additional context in comments.

1 Comment

+1. If the input XML files cannot be modified, create a "wrapper" XML document that references all input files using document().
4
  • 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);

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.