lxml is a sophisticated, powerful, free and unique Python module that binds the libxml2 and libxslt libraries, allowing Python developers to work with both XML and HTML files insider their Python code.
An XML processing library
lxml is an XML (Extensible Markup Language) processing library written in the Python programming language, specifically designed to follow the ElementTree API specification as much as possible.
It can extend the ElementTree API to expose specific functionality of the libxslt and libxml2 libraries, such as Relax NG (Next-Generation), XPath, XML Schema, c14n, XSLT (EXtensible Stylesheet Language), etc.
Use lxml to call Python code from XSLT stylesheets
Developers will be able to use the lxml program to call Python code from XSLT stylesheets and XPath expressions via extension functions. A wide range of tutorials are available on the project’s homepage (see the link at the end of the article).
The software is open source by design and combines the feature completeness and speed of the aforementioned libraries with the simplicity of Python’s API (Application Programming Interface).
Getting started with lxml
It is quite easy to install lxml on a GNU/Linux distribution using the source archive distributed on Softpedia and the project’s official website. Simply download the source package, save it on your Home directory, unpack it, open the Terminal app and navigate to the location of the extracted archive files (e.g. cd /home/softpedia/lxml-3.4.1).
Run the ‘make’ command to compile the program, which should take about 1-2 minutes on a modern computer. After a successful compilation, run the ‘make install’ command as root or the ‘sudo make install’ command as a privileged user to install lxml system wide.
Supports GNU/Linux and Microsoft Windows operating systems
The software is officially supported on GNU/Linux and Microsoft Windows operating systems. It has been successfully tested on 32-bit and 64-bit computers.