

The XSLT C library for Gnome
libxslt
This document describes libxslt, the
XSLT C library developped 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 GNU LGPL and a
derivative of the W3C IPR (check the Copyright and the IPR files in the
distribution). If you are not happy with this, drop me a mail.
- 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 gtk
doc).
- 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
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). I look at
reports there regularly and it's good to have a reminder when a bug is still
open. Check the instructions on
reporting bugs and be sure to specify that the bug is for the package
libxslt.
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..
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 libxml 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
- provice 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 xmlsoft.org or on the Gnome FTP server either
as a source
archive or RPM packages.
(NOTE that you need the libxml2, libxml2-devel, libxslt and libxslt-devel
packages installed to compile applications using libxslt.)
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 CVS:
CVS only : check the Changelog file
for a really accurate description
0.9.0: May 3 2001
- lot of various bugfixes, extended the regression suite
- xsltproc shoudl work with multiple params
- added an option to use xsltproc with HTML input
- improved the stylesheet compilation, processing of complex stylesheets
should be faster
- using the same stylesheet for concurent processing on multithreaded
programs should work now
- fixed another batch of namespace handling problems
- Implemented multiple level of sorting
0.8.0: Apr 22 2001
- fixed ansidecl.h problem
- fixed unparsed-entity-uri() and generate-id()
- sort semantic fixes and priority prob from William M. Brack
- fixed namespace handling problems in XPath expression computations
(requires libxml-2.3.7)
- fixes to current() and key()
- other, smaller fixes, lots of testing with N Walsh DocBook HTML
stylesheets
0.7.0: Apr 10 2001
- cleanup using stricter compiler flags
- command line parameter passing
- fix to xsltApplyTemplates from William M. Brack
- added the XSLTMark in the regression tests as well as document()
0.6.0: Mar 22 2001
- another beta
- requires 2.3.5, which provide XPath expression compilation support
- document() extension should fonction properly
- fixed a number or reported bugs
0.5.0: Mar 10 2001
- fifth beta
- some optimization work, for the moment 2 XSLT transform cannot use the
same stylesheet at the same time (to be fixed)
- fixed problems with handling of tree results
- fixed a reported strip-spaces problem
- added more reported/fixed bugs to the test suite
- incorporated William M. Brack fix for imports and global variables as
well as patch for with-param support in apply-templates
- a bug fix on for-each
0.4.0: Mar 1 2001
- fourth beta test, released at the same time of libxml2-2.3.3
- bug fixes
- some optimization
- started implement extension support, not finished
- implemented but not tested multiple file output
0.3.0: Feb 24 2001
- third beta test, released at the same time of libxml2-2.3.2
- lot of bug fixes
- some optimization
- added DocBook XSL based testsuite
0.2.0: Feb 15 2001
- second beta version, released at the same time as libxml2-2.3.1
- getting close to feature completion, lot of bug fixes, some in the HTML
and XPath support of libxml
- start becoming usable for real work. This version can now regenerate the
XML 2e HTML from the original XML sources and the associated stylesheets
(in section I of the
XML REC)
- Still misses extension element/function/prefixes support. Support of
key() and document() is not complete
0.1.0: Feb 8 2001
- first beta version, released at the same time as libxml2-2.3.0
- lots of bug fixes, first "testing" version, but incomplete
0.0.1: Jan 25 2001
- first alpha version released at the same time as libxml2-2.2.12
- Framework in place, should work on simple examples, but far from being
feature complete
The xsltproc command line tool tool
This program is the simplest way to use libxslt: from the command line. It
is also used for doing the regression tests of the library.
It takes as first argument the path or URL to an XSLT stylesheet, the next
arguments are filenames or URIs of the inputs to be processed. The output of
the processing is redirected on the standard output. There is actually a few
more options available:
orchis:~ -> xsltproc
Usage: xsltproc [options] stylesheet file [file ...]
Options:
--verbose or -v: show logs of what's happening
--timing: display the time used
--repeat: run the transformation 20 times
--debug: dump the tree of the result instead
--novalid: skip the Dtd loading phase
--noout: do not dump the result
--maxdepth val : increase the maximum depth
--html: the input document is(are) an HTML file(s)
--param name value
orchis:~ ->
The programming API
Okay this section is clearly incomplete. But integrating libxslt into your
application should be realitively easy. First check the few steps described
below, then for more detailed informations, look at the generated pages for the API and the source of
libxslt/xsltproc.c .
Basically doing an XSLT transformation can be done in a few steps:
- configure the parser for XSLT:
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
- parse the stylesheet with xsltParseStylesheetFile()
- parse the document with xmlParseFile()
- apply the stylesheet using xsltApplyStylesheet()
- save the result using xsltSaveResultToFile() if needed set
xmlIndentTreeOutput to 1
Steps 2,3, and 5 will probably need to be changed depending on you
processing needs and environment for example if reading/saving from/to memory,
or if you want to apply XInclude processing to the stylesheet or input
documents.
- Bjorn Reese is the author of the number support
Daniel Veillard
$Id: xslt.html,v 1.18 2001/05/03 17:03:51 veillard Exp $