what do I need to use XSLT 2.0 with Delphi
-
25-09-2019 - |
Question
what do I need to use XSLT 2.0 with Delphi(win32)? At the moment I use MSXML6 for all my xml transformation. But MSXML6 has no support for XSLT 2.0.
The solution (by ErvinS)
Using the AltovaXML library. After installation you have to import the AltovXML typelibrary. Then you can use a source like this:
procedure TfrmMainAltovaXmlDemo.btnTransformClick(Sender: TObject);
var
xmlApp: AltovaXMLLib_TLB.Application;
xslt2: AltovaXMLLib_TLB.XSLT2;
begin
xmlApp := AltovaXMLLib_TLB.CoApplication.Create;
xslt2 := xmlApp.XSLT2;
xslt2.InputXMLFromText := FInputXml;
xslt2.XSLFromText := FXslSource;
FOutputXML := xslt2.ExecuteAndGetResultAsString;
end;
OTHER TIPS
As far as I know there is no XSLT 2.0 implmenentation for Delphi itself.
In general, there are only a few XSLT 2.0 implementations around.
Wikipedia has an overview of XSLT processors.
- SAXON has an open source implementation of XSLT 2.0 in Java and .NET.
- XJR is a paid implementation in C/C++.
You can integrate all of them in your Delphi apps.
Depending on how close you want to have such an integration, there are a few starting points:
- Java is closest to integrate using JNA or JNI.
- .NET can be integrated using JCL, COM, Unmanaged Exports, Hydra, inverse P/Invoke.
- XJR can likely be integrated as a DLL
--jeroen
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow