I want to run several Xslts with one cached xml . However I can only find ways to run several xml files with a cachedxslt , but thats not what I want . As well as an XsltExecutable for Xslt , can there be an XsltExecutbale for Xmls, so that i can cache an xml , and run several xslts on it.
CodePudding user response:
You can create a DocumentBuilder and use parseXmlFromFile
(https://www.saxonica.com/saxon-c/doc11/html/classDocumentBuilder.html#a4fd6acc79cbed4ae3aa9bd062ffa080f) to parse your XML input file once into an XdmNode
, then you can feed that XdmNode as the input to any transformTo...
method you call on your XsltExecutable or run any applyTemplates..
method after setting that XdmNode as the initial match selection with the method setInitialMatchSelection
.