You are loading source xml, loading xslt and apply one to another
There is limited native XSLT2 support in .NET so i recomend using AltovaXML library altova xml, usage can be found there altova xml online documentaion
XSLT 2.0 transformation (XML to XML)
// Specify folder (AltovaXMLExamples folder)
// Check if filepath is correct for you
String strExamplesFolder = Environment.GetEnvironmentVariable("ProgramFiles") +
"\\Altova\\AltovaXML2011\\AltovaXMLExamples\\";
// Create a new AltovaXML instance and access its engines
Altova.AltovaXML.Application AltovaXML = new Altova.AltovaXML.Application();
// Use XSLT2 Engine of AltovaXML to transform simple.xml using CopyInputXSLT2.xsl
Altova.AltovaXML.IXSLT2 AltovaXMLXSLT2 = AltovaXML.XSLT2;
AltovaXMLXSLT2.InputXMLFileName = strExamplesFolder + "simple.xml";
AltovaXMLXSLT2.XSLFileName = strExamplesFolder + "CopyInputXSLT2.xsl";
AltovaXMLXSLT2.Execute(strExamplesFolder + "simpleOutputFromXML.xml");
XSLT 2.0 transformation (String to XML)
// Specify folder (AltovaXMLExamples folder)
// Check if filepath is correct for you
String strExamplesFolder = Environment.GetEnvironmentVariable("ProgramFiles") +
"\\Altova\\AltovaXML2011\\AltovaXMLExamples\\";
// Create a new AltovaXML instance and access its engines
Altova.AltovaXML.Application AltovaXML = new Altova.AltovaXML.Application();
// Use XSLT2 Engine of AltovaXML to transform input string using CopyInputXSLT2.xsl
Altova.AltovaXML.IXSLT2 AltovaXMLXSLT2 = AltovaXML.XSLT2;
AltovaXMLXSLT2.InputXMLFromText = "<?xml version='1.0'?><doc>Hello World</doc>";
AltovaXMLXSLT2.XSLFileName = strExamplesFolder + "CopyInputXSLT2.xsl";
AltovaXMLXSLT2.Execute(strExamplesFolder + "simpleOutputFromString.xml");
XSLT 2.0 transformation (String to String)
// Specify folder (AltovaXMLExamples folder)
// Check if filepath is correct for you
String strExamplesFolder = Environment.GetEnvironmentVariable("ProgramFiles") +
"\\Altova\\AltovaXML2011\\AltovaXMLExamples\\";
// Create a new AltovaXML instance and access its engines
Altova.AltovaXML.Application AltovaXML = new Altova.AltovaXML.Application();
// Use XSLT2 Engine of AltovaXML to transform input string using CopyInputXSLT2.xsl
Altova.AltovaXML.IXSLT2 AltovaXMLXSLT2 = AltovaXML.XSLT2;
AltovaXMLXSLT2.InputXMLFromText = "<?xml version='1.0'?><doc>Hello World</doc>";
AltovaXMLXSLT2.XSLFileName = strExamplesFolder + "CopyInputXSLT2.xsl";
String strResult = AltovaXMLXSLT2.ExecuteAndGetResultAsString();
// Show result
MessageBox.Show("XSLT 2.0 engine answered: " + strResult);