I have a C# Console Application that is bulk transforming around 100 XML files to a different markup using the XSLT document Transformer.xsl. Each of these XML files contains a hierarchy of topics that are assigned an ID based on the documents title and it's hierarchal position, e.g.
<topic id="BSAR_1.5.2">...some content...</topic>
To do this I am using the GetFileNameWithoutExtension C# method to get the file name and use it as the ID by passing it through an XSLCompliedTransform as a argument.
I know that the argument works from inside the XSL document, as it has been tested using Oxygen, and I know that without the argument the XSL transformer runs as follows in C#.
//create XSLT complied transformer
XslCompiledTransform xslTrans = new XslCompiledTransform();
//load in xslt
xslTrans.Load(xslPath);string fileExtension = Path.GetFileName(xmlPath);
string output= (pathDITA+"/DITA_"+fileExtension);
//Add arguments for TopicID
//XsltArgumentList argXSLT = new XsltArgumentList();
//String fileID = Path.GetFileNameWithoutExtension(xmlPath);
//argXSLT.AddParam("topicID","",fileID);
//convert XML document
xslTrans.Transform(xmlPath, output);
where pathDITA is a variable within the application for where the files are output to, and the arguments section has been commented out.
My issue stands at what Transformer to use when wanting to convert from an XML to an XML including arguments. Currently the transformer method used is XslCompiledTransform.Transform(string URI, string ResultsFile). I am struggling to find a version of this that allows an argument in the middle while still outputting to an XML file directly in the C# resource library.
Simply, what method (or process) would be needed to mimic
xslTrans.Transform(xmlPath,argXSLT,output);
where XMLpath and output are both XML files, and argsXSLT is the argument being passed in, as the current version returns a type error. Example XML & XSLT will be added if necessary.