0

I'm working on a project where it's requires accepting an XSL and XML as inputs and outputa an HTML file. I already have the XSL scripts, it's proven to work as expected when transforming an XML input to an HTML file using VBA scripts. I'm moving this to C++ and I'm looking for any libraries that can support this operations. I tried searching around and I found similar questions but they were all 10+ years old so I'm not sure if I'm missing a more modern and viable solution. I'm using MS Visual Studio 2017 and C++11, but the solutions I've found so far seems dated and I'm not sure how extensible they are for the future.

Similar posts about this:
How do I generate an HTML file using XSL?
Convert an XML in HTML using the XSLT process (MSXML in C++)

The top two options I'm considering moving forward with so far is:
1. XSLTProc
2. Xalan - C++

Are there any other recommendations I should take a look at?

As a side question, this post suggests XSLT is dead and I'm better off using a C++ XML parser and perform the operations natively. After searching for libraries to do this, they all seem dated and not supported anymore so I'm starting to think I should go with this suggestion. Would love to hear other opinions about this.
Are there any XSLT to C++ compilers available?

Thanks in advance for any suggestions.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
ssj_100
  • 149
  • 1
  • 11
  • On Windows, as far as I am aware, both MSXML 3 and MSXML 6 are part of the OS installation and if you use VBA to execute XSLT then you are most certainly using MSXML from VBA. You haven't shown whether you use any MSXML specific features or explained why using Xalan C++ or libxslt/xsltproc is a way to move "forward", given that both also only implement XSLT 1.0, as MSXML does. If you want to move forward in terms of XSLT then since 2017 we have XSLT 3.0, available for C/C++ as Saxon-C, see http://saxonica.com/download/c.xml. – Martin Honnen Jan 25 '20 at 12:22
  • That's for the response Martin, I also tried looking at MSXML, but I couldn't find any documentation on how to use it in my C++ project. And I couldn't find anyway to download those libraries. When I said Xalan C++ and libxslt was a way to move forward, I meant those were the only two libraries I could still download to include in my C++ project (Although I haven't tried building them yet). I will take a look at Saxon, thanks. – ssj_100 Jan 25 '20 at 13:12
  • 1
    I would think the MSDN docs https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms759192(v=vs.85) and https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms757060(v=vs.85) continue to apply, even if they have kind of archived that content. But as I said, MSXML is basically part of the Windows OS/the Windows platform. – Martin Honnen Jan 25 '20 at 13:25
  • I tried using msxml but I can't find the docs on how to get the relevant files for dev. The closest I came was: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms762799(v%3Dvs.85). I had to comment out some code to compile successfully, but then I ran into linker errors. My main issue is all the documentation tells you to use the msxml lib, and header files to setup your dev env but I can't find those files. I was able to to just do #include "msxml6.h" without having to do anything and relevant objects were recognized by VS studio. But I can't get pass the linker errors – ssj_100 Jan 25 '20 at 17:22
  • 1
    The lib files should be part of any Windows SDK you have installed, for instance in `C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64` for the 64bit version in the Windows SDK `10.0.18362.0`. – Martin Honnen Jan 25 '20 at 17:42
  • Thanks Martin, this was what I needed. No way in MS docs specified this folder for the msxml files so I was at a lost. I was able to get some sample code compiled and built successfully. I'm new to developing on windows and working with XSLT so apologies for any stupid questions, Thanks again! – ssj_100 Jan 27 '20 at 07:12

1 Answers1

1

If you want a modern XSLT processor with a C++ language binding, try Saxon/C. Unlike older processors it supports XSLT 3.0 rather than 1.0.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164