Core Features

LXP provides a core set of features that include external file inclusion, XML parsing, and a direct SQL interface to PostgreSQL. As of Version 0.8, SQL execution is performed with either a dynamic or persistent connection to the PostgreSQL RDBMS.

LXP also supports a few more advanced techniques commonly found in programming languages, such as variable setting, insertion and substitution, arrays, branching logic, loop iteration, and a basic search-and-replace variable formatting interface.

Content Inclusion and Management

The essential concept of content inclusion is that other files, or sources of data, can be included (e.g., inserted or embedded) within a requested document's HTML output. Instructing an LXP document to include another file means that the output from that included file will appear inline, as if it had been part of the originally requested document itself. This can aid both the efficiency and maintainability of a large, dynamic web site.

LXP can natively include a variety of external files, from plain HTML, to XML, to token-delimited flat files. However, one of the strongest features of LXP's content inclusion capability is that LXP can embed any content type that your Apache web server has been configured to handle.

Earlier incarnations of LXP had somewhat rigid support for the inclusion of PHP scripts. As of Version 0.8, however, LXP can include any available content type via Apache subrequests. This allows you to embed server-side documents written in languages including, but not limited to, PHP, Perl, and any executable CGI application. Any CGI arguments or LXP variables available to LXP are passed on to the included document as if it had been called directly with those variables through an HTTP request.

LXP also utilizes expat, a nonvalidating XML parsing library. While expat doesn't validate your XML based on a DTD, the XML to be parsed must at least be well-formed (e.g., no invalid characters, mismatched tags, etc.).

The XML parser implementation was written into LXP with support for easy RSS/RDF formats in particular (Rich Site Summary and Resource Description Framework, respectively). These file formats are available on popular web sites to provide a short summary of the information supplied on their site to other hosts that link to their content (e.g., the headlines from a news site, along with URL information).

LXP's XML method is evolving into a more generalized tool, but it can presently be used to a limited extent with any well-formed XML.

Direct SQL Methods and PostgreSQL Connectivity

LXP provides both dynamic and persistent PostgreSQL database connectivity, allowing for versatile execution of SQL statements. The SQL inclusion method allows the execution of a query from within an LXP document. Once a query is executed, its results are passed to the LXP parser for inline formatting. These values can either be displayed immediately, or set as variables for use later in the document.

The persistent connections, inline formatting, and direct SQL query tags lend LXP unparalleled ease of use in the arrangement of content from a database. An example use of the LXP database connectivity can be found in the Fingerless LXP package, a simple and flexible weblog implementation.

Fingerless

Fingerless, first introduced in LXP 0.7, is an LXP-based weblog system, similar to those seen on sites such as Slashdot.org and Kuro5hin.org.

As of the 0.8 release, the Fingerless implementation has been re-factored into an external package utilizing general LXP tags and persistent SQL connectivity. As such, this documentation will not cover the now deprecated Fingerless builtin methods, which will be removed from the LXP core in the next major release. For an example of a web site running Fingerless, however, visit: http://www.thelinuxreview.com.