The Extensible Markup Language (XML) is a World
Wide Web Consortium standard for the exchange of structured data in text
form. Its popularity stems from its universality. Any computer can
read a text file. With the proper tools, any computer can read any other
computer's XML files.
One of the most important of those tools is XSLT:
Extensible Stylesheet Language Transformations. XSLT
is a declarative language that allows you to
translate your XML into arbitrary text output
using a stylesheet. libxslt provides the
functions to perform the transformation.
libxslt is a free C language library
written by Daniel Veillard for the GNOME project
allowing you to write programs that perform XSLT
transformations.
While libxslt was written
under the auspices of the GNOME project, it does not
depend on any GNOME libraries. None are used in the
example in this tutorial.
This tutorial illustrates a simple program that reads an
XML file, applies a stylesheet and saves the resulting
output. This is not a program you would want to create
yourself. xsltproc, which is included with the
libxslt package, does the same thing and is
more robust and full-featured. The program written for this tutorial is a
stripped-down version of xsltproc designed to
illustrate the functionality of libxslt.
The full code for xsltproc is in
xsltproc.c in the libxslt
distribution. It also is available on the
web.
References:
W3C XML pageW3C
XSL page.libxslt
