

The XSLT C library for Gnome
libxslt
External documents:
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 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.. 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!).
If you need help with the XSLT language itself, I strongly suggest to
subscribe to XSL-list,
check the XSL-list
archives, the XSL
FAQ, and buy Michael Kay "XSLT Programmer's Reference" book published by
Wrox.
Check the following too before posting:
- 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)
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 xmlsoft.org (Seattle, France) 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.) Igor Zlatkovic is now the maintainer
of the Windows port, he
provides binaries
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
1.0.5: Oct 10 2001
- some portability fixes, including Windows makefile updates from
Igor
- fixed a dozen bugs on XSLT and EXSLT (me and Thomas Broyer)
- support for Saxon's evaluate and expressions extensions added (initial
contribution from Darren Graves)
- better handling of XPath evaluation errors
1.0.4: Sep 12 2001
- Documentation updates from John fleck
- bug fixes (DocBook FO generation should be fixed) and portability
improvements
- Thomas Broyer improved the existing EXSLT support and added String,
Time and Date core functions support
1.0.3: Aug 23 2001
- XML Catalog support see the doc
- New NaN/Infinity floating point code
- A few bug fixes
1.0.2: Aug 15 2001
- lot of bug fixes, increased the testsuite
- a large chunk of EXSLT is implemented
- improvements on the extension framework
- documentation improvements
- Windows MSC projects files should be up-to-date
- handle attributes inherited from the DTD by default
1.0.1: July 24 2001
- initial EXSLT framework
- better error reporting
- fixed the profiler on Windows
- bug fixes
1.0.0: July 10 2001
- a lot of cleanup, a lot of regression tests added or fixed
- added a documentation for writing
extensions
- fixed some variable evaluation problems (with William)
- added profiling of stylesheet execution accessible as the xsltproc
--profile option
- fixed element-available() and the implementation of the various
chunking methods present, Norm Walsh provided a lot of feedback
- exclude-result-prefixes and namespaces output should now work as
expected
- added support of embedded stylesheet as described in section 2.7 of the
spec
0.14.0: July 5 2001
- lot of bug fixes, and code cleanup
- completion of the little XSLT-1.0 features left unimplemented
- Added and implemented the extension API suggested by Thomas Broyer
- the Windows MSC environment should be complete
- tested and optimized with a really large document (DocBook Definitive
Guide) libxml/libxslt should really be faster on serious workloads
0.13.0: June 26 2001
- lots of cleanups
- fixed a C++ compilation problem
- couple of fixes to xsltSaveTo()
- try to fix Docbook-xslt-1.4 and chunking, updated the regression test
with them
- fixed pattern compilation and priorities problems
- Patches for Windows and MSC project mostly contributed by Yon Derek
- update to the Tutorial by John Fleck
- William fixed bugs in templates and for-each functions
- added a new interface xsltRunStylesheet() for a more flexible output
(incomplete), added -o option to xsltproc
0.12.0: June 18 2001
- fixed a dozen of bugs reported
- HTML generation should be quite better (requires libxml-2.3.11 upgrade
too)
- William fixed some problems with document()
- Fix namespace nodes selection and copy (requires libxml-2.3.11 upgrade
too)
- John Fleck added a
tutorial
- Fixes for namespace handling when evaluating variables
- XInclude global flag added to process XInclude on document() if
requested
- made xsltproc --version more detailed
0.11.0: June 1 2001
Mostly a bug fix release.
- integration of catalogs from xsltproc
- added --version to xsltproc for bug reporting
- fixed errors when handling ID in external parsed entities
- document() should hopefully work correctly but ...
- fixed bug with PI and comments processing
- William fixed the XPath string functions when using unicode
0.10.0: May 19 2001
- cleanups to make stylesheet read-only (not 100% complete)
- fixed URI resolution in document()
- force all XPath expression to be compiled at stylesheet parsing time,
even if unused ...
- Fixed HTML default output detection
- Fixed double attribute generation #54446
- Fixed {{ handling in attributes #54451
- More tests and speedups for DocBook document transformations
- Fixed a really bad race like bug in xsltCopyTreeList()
- added a documentation on the libxslt internals
- William Brack and Bjorn Reese improved format-number()
- Fixed multiple sort, it should really work now
- added a --docbook option for SGML DocBook input (hackish)
- a number of other bug fixes and regression test added as people were
submitting them
0.9.0: May 3 2001
- lot of various bugfixes, extended the regression suite
- xsltproc should 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 concurrent 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 function 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
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:
--version or -V: show the version of libxml and libxslt used
--verbose or -v: show logs of what's happening
--output file or -o file: save to a given file
--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)
--docbook: the input document is SGML docbook
--param name value : pass a (parameter,value) pair
--nonet refuse to fetch DTDs or entities over network
--warnnet warn against fetching over the network
--catalogs : use the catalogs from $SGML_CATALOG_FILES
--xinclude : do XInclude processing on document intput
--profile or --norman : dump profiling informations
orchis:~ ->
Okay this section is clearly incomplete. But integrating libxslt into your
application should be relatively 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 and the tutorial.
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.
I'm still waiting for someone to contribute a simple XSLT processing
module for Apache :-)
Daniel Veillard
$Id: xslt.html,v 1.46 2001/10/10 10:00:03 veillard Exp $