The XSLT C library for GNOME
libxslt
Libxslt is the XSLT C library
developed for the GNOME project. XSLT itself is a an XML language to define
transformation for XML. Libxslt is based on libxml2 the XML C library developed for the
GNOME project. It also implements most of the EXSLT set of processor-portable extensions
functions and some of Saxon's evaluate and expressions extensions.
People can either embed the library in their application or use xsltproc
the command line processing tool. This library is free software and can be
reused in commercial applications (see the intro)
External documents:
Logo designed by Marc Liyanage.
This document describes libxslt,
the XSLT C library developed for the
GNOME project.
Here are some key points about libxslt:
- Libxslt is a C implementation
- Libxslt is based on libxml for XML parsing, tree manipulation and XPath
support
- It is written in plain C, making as few assumptions as possible, and
sticking closely to ANSI C/POSIX for easy embedding. Should works on
Linux/Unix/Windows.
- This library is released under the MIT
Licence
- Though not designed primarily with performances in mind, libxslt seems
to be a relatively fast processor.
There are some on-line resources about using libxslt:
- Check the API
documentation automatically extracted from code comments (using the
program apibuild.py, developed for libxml, together with the xsl script
'newapi.xsl' and the libxslt xsltproc program).
- Look at the mailing-list
archive.
- Of course since libxslt is based on libxml, it's a good idea to at
least read libxml description
If you need help with the XSLT language itself, here are a number of
useful resources:
Well, bugs or missing features are always possible, and I will make a
point of fixing them in a timely fashion. The best way to report a bug is to
use the GNOME bug
tracking database (make sure to use the "libxslt" module name). Before
filing a bug, check the list of existing
libxslt bugs to make sure it hasn't already been filed. I look at reports
there regularly and it's good to have a reminder when a bug is still open. Be
sure to specify that the bug is for the package libxslt.
For small problems you can try to get help on IRC, the #xml channel on
irc.gnome.org (port 6667) usually have a few person subscribed which may help
(but there is no guarantee and if a real issue is raised it should go on the
mailing-list for archival).
There is also a mailing-list xslt@gnome.org for libxslt, with an on-line archive. To subscribe
to this list, please visit the associated Web page
and follow the instructions.
Alternatively, you can just send the bug to the xslt@gnome.org list, if it's really libxslt
related I will approve it.. Please do not send me mail directly especially
for portability problem, it makes things really harder to track and in some
cases I'm not the best person to answer a given question, ask the list
instead. Do not send code, I won't debug it (but patches are
really appreciated!).
Please note that with the current amount of virus and SPAM, sending mail
to the list without being subscribed won't work. There is *far too many
bounces* (in the order of a thousand a day !) I cannot approve them manually
anymore. If your mail to the list bounced waiting for administrator approval,
it is LOST ! Repost it and fix the problem triggering the error. Also please
note that emails with
a legal warning asking to not copy or redistribute freely the information
they contain are NOT acceptable for the mailing-list,
such mail will as much as possible be discarded automatically, and are less
likely to be answered if they made it to the list, DO NOT
post to the list from an email address where such legal requirements are
automatically added, get private paying support if you can't share
information.
Check the following too before
posting:
- use the search engine to get information
related to your problem.
- make sure you are using a recent
version, and that the problem still shows up in those
- check the list
archives to see if the problem was reported already, in this case
there is probably a fix available, similarly check the registered
open bugs
- make sure you can reproduce the bug with xsltproc, a very useful thing
to do is run the transformation with -v argument and redirect the
standard error to a file, then search in this file for the transformation
logs just preceding the possible problem
- Please send the command showing the error as well as the input and
stylesheet (as an attachment)
Then send the bug with associated information to reproduce it to the xslt@gnome.org list; if it's really libxslt
related I will approve it. Please do not send mail to me directly, it makes
things really hard to track and in some cases I am not the best person to
answer a given question, ask on the list.
To be really clear about support:
- Support or help request MUST be sent to
the list or on bugzilla in case of problems, so that the Question
and Answers can be shared publicly. Failing to do so carries the implicit
message "I want free support but I don't want to share the benefits with
others" and is not welcome. I will automatically Carbon-Copy the
xslt@gnome.org mailing list for any technical reply made about libxml2 or
libxslt.
- There is no guarantee for support,
if your question remains unanswered after a week, repost it, making sure
you gave all the detail needed and the information requested.
- Failing to provide information as requested or double checking first
for prior feedback also carries the implicit message "the time of the
library maintainers is less valuable than my time" and might not be
welcome.
Of course, bugs reports with a suggested patch for fixing them will
probably be processed faster.
If you're looking for help, a quick look at the list archive may actually
provide the answer, I usually send source samples when answering libxslt
usage questions. The auto-generated documentation is
not as polished as I would like (I need to learn more about Docbook), but
it's a good starting point.
You can help the project in various ways, the best thing to do first is to
subscribe to the mailing-list as explained before, check the archives and the GNOME bug
database::
- provide patches when you find problems
- provide the diffs when you port libxslt to a new platform. They may not
be integrated in all cases but help pinpointing portability problems
and
- provide documentation fixes (either as patches to the code comments or
as HTML diffs).
- provide new documentations pieces (translations, examples, etc ...)
- Check the TODO file and try to close one of the items
- take one of the points raised in the archive or the bug database and
provide a fix. Get in touch with me
before to avoid synchronization problems and check that the suggested
fix will fit in nicely :-)
The latest versions of libxslt can be found on the xmlsoft.org server. (NOTE that
you need the libxml2,
libxml2-devel,
libxslt and libxslt-devel
packages installed to compile applications using libxslt.) Igor Zlatkovic is now the maintainer of
the Windows port, he provides
binaries. CSW provides
Solaris binaries, and
Steve Ball provides Mac Os X
binaries.
Snapshot:
Contribs:
I do accept external contributions, especially if compiling on another
platform, get in touch with me to upload the package. I will keep them in the
contrib directory
Libxslt is also available from GIT:
- Troubles compiling or linking programs using libxslt
Usually the problem comes from the fact that the compiler doesn't get
the right compilation or linking flags. There is a small shell script
xslt-config which is installed as part of libxslt usual
install process which provides those flags. Use
xslt-config --cflags
to get the compilation flags and
xslt-config --libs
to get the linker flags. Usually this is done directly from the
Makefile as:
CFLAGS=`xslt-config --cflags`
LIBS=`xslt-config --libs`
Note also that if you use the EXSLT extensions from the program then
you should prepend -lexslt to the LIBS options
- passing parameters on the xsltproc command line doesn't work
xsltproc --param test alpha foo.xsl foo.xml
the param does not get passed and ends up as ""
In a nutshell do a double escaping at the shell prompt:
xsltproc --param test "'alpha'" foo.xsl foo.xml
i.e. the string value is surrounded by " and ' then terminated by '
and ". Libxslt interpret the parameter values as XPath expressions, so
the string ->alpha<- is intepreted as the node set
matching this string. You really want ->'alpha'<- to
be passed to the processor. And to allow this you need to escape the
quotes at the shell level using ->"'alpha'"<- .
or use
xsltproc --stringparam test alpha foo.xsl foo.xml
- Is there C++ bindings ?
Yes for example xmlwrapp , see the related pages about bindings
See the git page
to get a description of the recent commits.
Those are the public releases made:
1.1.28: Nov 21 2012
- Portability:
Fix python build by using libxsltmod_la_CPPFLAGS instead of AM_CPPFLAGS (Alexandre Rostovtsev),
configure should be more careful with linker script (Igor Pashev),
add gcrypt library in LIBADD, not LDFLAGS, as recommended (Roumen Petrov)
- Bug fixes:
Fix generate-id() to avoid generating the same ID (Stewart Brodie),
Fix crash with empty xsl:key/@match attribute (Nick Wellnhofer),
Crash when passing an uninitialized variable to document() (Nick Wellnhofer),
Add missing test docs to EXTRA_DIST (Nick Wellnhofer),
Fix regression: Default namespace not correctly used (Nick Wellnhofer)
- Cleanups:
Remove xsltTransStorageAdd and xsltTransStorageRemove from symbols.xml (Daniel Veillard),
autogen.sh cleanup (Daniel Richard),
consistent use of xslt processor (Roumen Petrov),
Add object files in tests/plugins to .gitignore (Nick Wellnhofer),
Fix error on bug-165 regression test (Daniel Veillard),
Remove xsltTransStorageAdd and xsltTransStorageRemove (Daniel Veillard),
1.1.27: Sep 12 2012
- Portability:
xincludestyle wasn't protected with LIBXML_XINCLUDE_ENABLED (Michael Bonfils),
Portability fix for testThreads.c (IlyaS),
FreeBSD portability fixes (Pedro F. Giffuni),
check for gmtime - on mingw* hosts will enable date-time function (Roumen Petrov),
use only native crypto-API for mingw* hosts (Roumen Petrov),
autogen: Only check for libtoolize (Colin Walters),
minimal mingw support (Roumen Petrov),
configure: acconfig.h is deprecated since autoconf-2.50 (Stefan Kost),
Fix a small out of tree compilation issue (Hao Hu),
Fix python generator to not use deprecated xmllib (Daniel Veillard),
link python module with python library (Frederic Crozat)
- Documentation:
Tiny doc improvement (Daniel Veillard),
Various documentation fixes for docs on internals (C. M. Sperberg-McQueen)
- Bug fixes:
Report errors on variable use in key (Daniel Veillard),
The XSLT namespace string is a constant one (Daniel Veillard),
Fix handling of names in xsl:attribute (Nick Wellnhofer),
Reserved namespaces in xsl:element and xsl:attribute (Nick Wellnhofer),
Null-terminate result string of cry:rc4_decrypt (Nick Wellnhofer),
EXSLT date normalization fix (James Muscat),
Exit after compilation of invalid func:result (Nick Wellnhofer),
Fix for EXSLT func:function (Nick Wellnhofer),
Rewrite EXSLT string:replace to be conformant (Nick Wellnhofer),
Avoid a heap use after free error (Chris Evans),
Fix a dictionary string usage (Chris Evans),
Output should not include extraneous newlines when indent is off (Laurence Rowe),
document('') fails to return stylesheets parsed from memory (Jason Viers),
xsltproc should return an error code if xinclude fails (Malcolm Purvis),
Forwards-compatible processing of unknown top level elements (Nick Wellnhofer),
Fix system-property with unknown namespace (Nick Wellnhofer),
Hardening of code checking node types in EXSLT (Daniel Veillard),
Hardening of code checking node types in various entry point (Daniel Veillard),
Cleanup of the pattern compilation code (Daniel Veillard),
Fix default template processing on namespace nodes (Daniel Veillard),
Fix a bug in selecting XSLT elements (Daniel Veillard),
Fixed bug #616839 (Daniel Mustieles),
Fix some case of pattern parsing errors (Abhishek Arya),
preproc: fix the build (Stefan Kost),
Fix a memory leak with xsl:number (Daniel Veillard),
Fix a problem with ESXLT date:add() with January (money_seshu Dronamraju),
Fix a memory leak if compiled with Windows locale support (Daniel Veillard),
Fix generate-id() to not expose object addresses (Daniel Veillard),
Fix curlies support in literals for non-compiled AVTs (Nick Wellnhofer),
Allow whitespace in xsl:variable with select (Nick Wellnhofer),
Small fixes to locale code (Nick Wellnhofer),
Fix bug 602515 (Nick Wellnhofer),
Fix popping of vars in xsltCompilerNodePop (Nick Wellnhofer),
Fix direct pattern matching bug (Nick Wellnhofer)
- Improvements:
Add the saxon:systemId extension (Mike Hommey),
Add an append mode to document output (Daniel Veillard),
Add new tests to EXTRA_DIST (Nick Wellnhofer),
Test for bug #680920 (Nick Wellnhofer),
fix regresson in Various "make distcheck" and other fixes (Roumen Petrov),
Various "make distcheck" and other fixes (Daniel Richard G),
Fix portability to upcoming libxml2-2.9.0 (Daniel Veillard),
Adding --system flag support to autogen.sh (Daniel Veillard),
Allow per-context override of xsltMaxDepth, introduce xsltMaxVars (Jérôme Carretero),
autogen.sh: Honor NOCONFIGURE environment variable (Colin Walters),
configure: support silent automake rules if possible (Stefan Kost),
Precompile patterns in xsl:number (Nick Wellnhofer),
Fix some warnings in the refactored code (Nick Wellnhofer),
Adding new generated files (Daniel Veillard),
profiling: add callgraph report (Stefan Kost)
- Cleanups:
Big space and tabs cleanup (Daniel Veillard),
Fix authors list (Daniel Veillard),
Cleanups some of the test makefiles (Daniel Richard),
Remove .cvsignore files which are not needed anymore (Daniel Veillard),
Cleanup some misplaced spaces and tabs (Daniel Veillard),
Augment list of ignored files (Daniel Veillard),
configure: remove checks for isinf and isnan as those are not used anyway (Stefan Kost),
Point to GIT for source code and a bit of cleanup (Daniel Veillard),
Get rid of specific build setup and STATIC_BINARIES (Daniel Veillard)
1.1.26: Sep 24 2009
- Improvement:
Add xsltProcessOneNode to exported symbols for lxml (Daniel Veillard)
- Bug fixes:
Fix an idness generation problem (Daniel Veillard),
595612 Try to fix some locking problems (Daniel Veillard),
Fix a crash on misformed imported stylesheets (Daniel Veillard)
1.1.25: Sep 17 2009
- Features:
Add API versioning and various cleanups (Daniel Veillard),
xsl:sort lang support using the locale (Nick Wellnhofer and Roumen Petrov)
- Documentation:
Fix the download links for Solaris (Daniel Veillard),
Fix makefile and spec file to include doc in rpm (Daniel Veillard)
- Portability:
Make sure testThreads is linked with pthreads (Daniel Veillard),
Fix potential crash on debug of extensions Solaris (Ben Walton),
applied patch from Roumen Petrov for mingw cross compilation problems (Roumen Petrov),
patch from Richard Jones to build shared libs with MinGW cross-compiler (Richard Jones),
fix include path when compiling with MinGW (Roumen Petrov),
portability fixes ( Nick Wellnhofer and Roumen Petrov)
- Bug fixes:
Big fixes of pattern compilations (Nick Wellnhofer),
Fix uses of xmlAddChild for error handling (Daniel Veillard),
Detect deep recusion on function calls (Daniel Veillard),
Avoid an error in namespace generation (Martin),
Fix importing of encoding from included stylesheets (Nick Wellnhofer),
Fix problems with embedded stylesheets and namespaces (Martin),
QName parsing fix for patterns (Martin),
Crash compiling stylesheet with DTD (Martin),
Fix xsl:strip-space with namespace and wildcard (Nick Wellnhofer),
Fix a mutex deadlock on unregistered extensions (Nix),
567192 xsltproc --output option ignore --xinclude (Joachim Breitner),
Fix redundant headers in list (Daniel Veillard),
134754 Configure's --with-html-dir related fixes (Julio M. Merino Vidal),
305913 a serious problem in extensions reentrancy (Daniel Veillard),
Fix an idness issue when building the tree (Daniel Veillard),
Fixed indexing error reported by Ron Burk on the mailing list. (William M. Brack),
prevent some unchecked pointer accesses (J