J'essaie de passer de XSLTCompiledTransformation à Saxon XSLTTransformation mais j'ai des problèmes avec la spécification de la destination de sortie en tant que document XML pour la transformation saxon xslt.Définir XMLDocument comme Saxon.Api.XMLDestination
Ceci est l'ancien code utilisé pour exécuter des transformations XSLT:
XsltCompiledTransform transform = ... load xslt transform
XsltArgumentList arguments = ... load arguments
var result = new XmlDocument();
using(var xmlReader = new XmlNodeReader(inputXml)) {
using(var writer = result.CreateNavigator().AppendChild())
transform.Transform(xmlReader, arguments, writer);
}
J'ai essayé de réécrire cette option pour utiliser la bibliothèque saxonne mais j'ai problème avec xmlDocument de sortie:
XsltTransformer transform = ... load xslt transform
var result = new XmlDocument();
Processor processor = new Processor()
XdmNode input = pro.NewDocumentBuilder().Wrap(inputXml);
transform.InitialContextNode = input;
//tried specifying result as XMLDestination:
transform.Run(result); //getting error
//also tried this:
using(var writer = result.CreateNavigator().AppendChild())
transform.Run(writer);
Comment Je convertis XMLDocument en XmlDestination ou comment puis-je configurer la destination, puis convertir ce résultat en XMLDocument?