[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Calling C++ from XSLT
Hi Franck, Yes it is possible. XSLT (1.0 and 2.0) defines an extension mechanism that allows a stylesheet to declare extension functions and elements. However, it depends on your XSLT engine as to how the engine interfaces with your C++ code when it encounters a call to the extension. You should check the documentation of your XSLT engine to see what's involved. BTW, I developed TclXSLT; a binding of libxslt to the Tcl scripting language. This allows Tcl to setup and invoke an XSL stylesheet. It also allows a Tcl script to define an extension and implement extension functions and elements. It is quite easy to interface Tcl with C/C++. I mention this just to show that it can be done and I've done it - you probably don't want to have to use a third-party language for your purpose. One thing to note is that if your data is binary then it cannot be included directly in an XML document, which is the source for your XSL stylesheet. You would have to base64 encode the binary data and have your extension decode it before trying to sort it. Hope that helps, Steve Ball On 08/11/2011, at 5:10 AM, Franck Houssen wrote: > > > Hello xsl-list, > > Is it possible to call a C++ code (or function) from an XSLT sheet ? If yes, do you know some tutorial / guide / user manual dealing with this topic ? > A subsidiary question : is it possible to trigger system calls from an XSLT sheet ? (to trigger the execution of a C++ program) > > > > I'am experienced in programming (C++, Java) but I'am new to XML / XSLT purposes. > > Starting from w3c.org, I started to find out more about XSLT. Then, I found the mulberrytech web site and I decided to post this question !... > > Here is my need : > > 1. step 1 : I have text files and binary datas (little or big endian) generated by C++, Java or Fortran (on Windows or Unix OS) that I need to sort > > 2. step 2 : to sort datas, I believed XSLT could be the suited solution (avoiding writing a painfull-to-write-and-maintian-C++ code to sort datas) > > 3. step 3 : when sorting with XSLT, I need to call C++ (Java, Fortran, ...) to read binary data to know how to handle them and which transformation should be applied (according to associated text files) > > > Could you give me a solution ? Some clue ? A link to some documentation ? A book ? Or anything that could help me ?!... > If you can't help me, could you forward this mail to somebody that could help me ? > > Regards, > > Franck
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|