Does Libxslt support mutable arguments? - xslt

In our company, we are moving from MSXML 6.0 engine to Libxslt.
Our XSLT code contains a lot of flags, counters and arrays implemented in JS, which MSXML supported and Libxslt does not.
As a replacement, I am looking for some sort of mutable arguments support. Does Libxslt have one? Something along the line of saxon:assignable functionality
I know that that is against the "natural" language design, but I am dealing with a large body of flawed code that would be very difficult to re-write...

Related

Alternative XSLT processor to Apache Xalan

I am currently using the Apache Xalan XSLT processor in my Java application, but I would like to use some alternative solution which supports use of extension functions. Xalan seems to be out of date and buggy. I know of Saxonixa Saxon, but it is closed sourced. Is there some open source and well working alternative?
The current open source version of Saxon, Saxon-HE 9.9, supports "integrated extension functions" (functions written to a particular Saxon-defined Java interface). It doesn't support "reflexive" extension functions (calls to arbitrary Java classes/methods found on the classpath).
Note that if you move to Saxon, with support for XSLT 2.0 and 3.0, you will find there is much less need for calling out to Java, because (a) the built-in function library is much larger, and (b) you can implement your own functions using the xsl:function declaration.

How to transform XML and XSLT using Visual C++ 6

I have to admit that I'm still using Visual C++ 6 and don't plan to upgrade any time soon due to the complexity of the project I'm working on.
Can anyone provide me an example to transform XML data with XSLT stylesheet using Visual C++ 6 in unmanaged code? If this old workhorse doesn't have that feature, which component is considered to be the best in the market?
From Windows apps one XSLT processor to use is the COM object as part of the MSXML SDK. (I have used early versions of this with VS6 but as it is COM I can't see why this will not work with the latest version)
You can also use pure C/C++ libraries such as Xalan or Aribica
You could have a look at the answers to this SO question: 'Is there any C++ XSLT library?'.
Apache Xalan looks to be appropriate, though I have no personal experience with this lib.
Another option is to run the XSLT processor (executable) directly from your program via system() call or similar mechanism.
If you really need a COM component to achieve what you want, you might consider to wrap one of these solutions in your own COM component implementation.

XML file Generator

Any recommendations for XML generators in C++?
There are quite a few XML generators for C++. Some of them work with DOM, others can serialize your classes, and yet others work in even more different ways, like Boost.PropertyTree. Whichever you should choose, depends entirely on your requirements.
If you need to write a small set of data to an XML file (and may also want to write this data to other formats in the end), consider using Boost.PropertyTree. If you want to serialize C++ classes to XML, or make C++ class representation of XSD Schemas, consider using a binding generator such as CodeSynthesis XSD. And if you just want to manipulate the XML directly, you can use a DOM parser/writer like the cross-platform Xerces C++.
MSXML is a sensible option if you're limiting your application to Windows.
Xerces could prove useful if you're wanting to write code that can be ported to other platforms.
I'm sure there are a few that exist already, but if one were inclined to implement their own it would be an easy task using Boost.Spirit.Karma.

Single file non-validating xml parser/reader

I'm looking for a simple non-validating XML parser in either C or C++.
Several years back I found one that was just a single file solution but I can't find
it anymore.
I'm after some links and suggested ones that are very small and lightweight
ideally suited for an embedded platform.
Expat
You can work with or without validation and in "streaming mode". It is very lightweight.
What about something like pugixml. From their site...
pugixml is a light-weight C++ XML
processing library. It features:
DOM-like interface with rich traversal/modification capabilities
Extremely fast non-validating XML parser which constructs the DOM
tree from an XML file/buffer
XPath 1.0 implementation for complex data-driven tree queries
Full Unicode support with Unicode interface variants and
automatic encoding conversions
The library is extremely portable and
easy to integrate and use.
pugixml is developed and maintained
since 2006 and has many users. All
code is distributed under the MIT
license, making it completely free to
use in both open-source and
proprietary applications.
Also, this answer has more info.
There is also tinyxml and RapidXml.
There is definitely a pure C, tiny xml parser available. It was cited in an earlier answer on SO, but I can't find it right now. If I remember right, it's just a few hundred lines of code.
Update: Here's the question/answer that references it:
Is there a good tiny XML parser for an embedded C project?
And the actual code:
http://mercurial.intuxication.org/hg/cstuff/file/tip/tinyxml
RapidXML is a single-header (multiple headers if you want extra functionality) ultra-lightweight, ultra-fast implementation. It can operate in "destructive" mode, that means by setting pointers right into the XML and possibly overwriting some, avoiding all extra memory allocations and data copies.
tinyxml is not precisely single-header, but it is still fairly lightweight compared to other parsers. I've used it for half a decade without ever encountering an issue. The author has recently started with "tinyxml-2", which is supposedly better and even more lightweight, but I've not had occasion to actually try that one yet.
http://mercurial.intuxication.org/hg/cstuff/file/tip/tinyxml
can this parser work with nested XML like
<CServiceType>
<serno>61</serno>
<caption1 />
<caption2>Satelite</caption2>
<caption3 />
</CServiceType>

VC++ project: MSXML vs any other XML libraries

We are aware of MSXML, based on COM technologies. We want to use it for a VC++ project starting soon. Are there any other XML libraries do good compared to MSXML?
TinyXML - A C++ open source library
Will you be using the .Net Framework if so you may want to look at using linq to xml.
Take a look at RapidXML. Also, Boost.PropertyTree is an abstraction over property trees (XML, JSON, INI, INFO at the time of writing) and relies on RapidXML for its XML parser.
We ditched MSXML in favor of Xerces for our project, although Xerces is also a big, complicated beast. The TinyXML suggestion is probably a good one if it does everything you need it to. If you only need basic SAX model support (and not a DOM), then you might also consider expat which is one of the first widely used XML parsers.
LIBXML
"Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), it is free software available under the MIT License."
I have used it for many years on Win32 projects without problem. It supports both SAX and DOM style reading.
You must take a look at Microsoft XmlLite which is a pull parser for pure C++. The primary goals of XmlLite are ease of use, performance, and standards compliance.