“Extensible Markup Language (XML) is a simple, very flexible text format derived from SGML. Originally designed to meet the challenges of large-scale electronic publishing, XML is also playing an increasingly important role in the exchange of a wide variety of data on the Web and elsewhere.” — W3C XML Introduction.
<?xml version="1.0" encoding="iso-8859-2"?>
<!DOCTYPE eolas SYSTEM "http://sial.org/_xs/eolas/DTD">
<?xml-stylesheet href="html.xsl" type="text/xsl" title="default"?>
<eolas xmlns:xlink="http://www.w3.org/1999/xlink">
…
<acronym xlink:href="http://www.w3.org/TR/xlink/">
<abbr>XLink</abbr>
<name>XML Linking Language</name>
</acronym>
…
</eolas>
“XSLT is designed for use as part of XSL, which is a stylesheet language for XML. In addition to XSLT, XSL includes an XML vocabulary for specifying formatting. XSL specifies the styling of an XML document by using XSLT to describe how the document is transformed into another XML document that uses the formatting vocabulary.”
“XSLT is also designed to be used independently of XSL. However, XSLT is not intended as a completely general-purpose XML transformation language. Rather it is designed primarily for the kinds of transformations that are needed when XSLT is used as part of XSL.” — W3C XSLT Abstract.
<a href="http://www.faqs.org/rfcs/rfc1869.html">RFC 1896</a>
<rfc>1869</rfc>
<?xml version="1.0"?>
<?xml-stylesheet href="default.xsl" type="text/xsl" title="default"?>
<?xml-stylesheet href="lynx.xsl" type="text/xsl" title="lynx" alternate="yes"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
"http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
“Apache AxKit is an XML Application Server for Apache. It provides on-the-fly conversion from XML to any format, such as HTML, WAP or text using either W3C standard techniques, or flexible custom code. AxKit also uses a built-in Perl interpreter to provide some amazingly powerful techniques for XML transformation.” — AxKit.org Introduction.
As of AxKit version 1.6; see the AxKit mailing list for discussion of potential problems with specific releases (e.g. XML and XSLT libraries).
$ du -sh htdocs ../tmp/axkit-cache
2.3M htdocs
6.3M ../tmp/axkit-cache
<IfModule mod_perl.c>
PerlModule AxKit
PerlFreshRestart On
</IfModule>
Inside <Files>, <Location>, <Directory>, or .htaccess.
# limit what filetypes AxKit deals with
AddHandler axkit .xml .dkb
# use libxml2/libxslt for XSLT work
AxAddStyleMap text/xsl Apache::AxKit::Language::LibXSLT
# custom page instead of "500 server in flames"
AxErrorStylesheet text/xsl /_xs/axkit/error.xsl
# good for static content
AxCacheDir /tmp/axkit-cache
AxGzipOutput On
# make various request data available to stylesheets
AxAddPlugin Apache::AxKit::Plugin::AddXSLParams::Request
PerlSetVar AxAddXSLParamGroups "Request-Common"
# file extension mapping
<Files *.dkb>
AxAddProcessor text/xsl /_xs/docbook/html/docbook.xsl
</Files>
# spare /wc3/p3p.xml from AxKit
<Location /w3c/>
AxResetStyleMap
AxResetProcessors
</Location>
# map HTTP User-Agent by regex to stylesheet title
AxAddPlugin Apache::AxKit::StyleChooser::UserAgent
PerlSetVar AxUAStyleMap "lynx => Lynx,\
mozmac => ^Mozilla\/.+?Macintosh.+?Gecko"
# map ?style=lynx arguments to stylesheet title
AxAddPlugin Apache::AxKit::StyleChooser::QueryString
# map stylesheet titles to various XML formats
<AxStyleName "#default">
AxAddRootProcessor text/xsl /_xs/eolas/default.xsl eolas
AxAddRootProcessor text/xsl /_xs/docbook/xhtml/docbook.xsl book
AxAddRootProcessor text/xsl /_xs/cvs2cl/default.xsl changelog
</AxStyleName>
<AxStyleName "lynx">
AxAddRootProcessor text/xsl /_xs/eolas/lynx.xsl eolas
AxAddRootProcessor text/xsl /_xs/docbook/html/docbook.xsl book
AxAddRootProcessor text/xsl /_xs/cvs2cl/lynx.xsl changelog
</AxStyleName>
<AxStyleName "mozmac">
…
AddDefaultCharset utf-8
image/svg+xml svg svgz
“FOP (Formatting Objects Processor) is the world's first print formatter driven by XSL formatting objects and the world's first output independent formatter. It is a Java application that reads a formatting object tree and then renders the resulting pages to a specified output. Output formats currently supported are PDF, PCL, PS, SVG, XML (area tree representation), Print, AWT, MIF and TXT. The primary output target is PDF.” — FOP Introduction.
Need to render XSL-FO to PDF for presentation.
$ xsltproc fo-slides.xsl practical-xml.xml > practical-xml.fo
$ java org.apache.fop.apps.Fop practical-xml.fo practical-xml.pdf
$ java org.apache.fop.apps.Fop \
-xsl fo-slides.xsl \
-xml practical-xml.xml test.pdf
[INFO] FOP 0.20.4
[ERROR] null
$ xmllint --noout test.xsl
$ xmllint --encode utf8 --format raw.xml > test.xsl
<xsl:template match="*">
<xsl:message>
<xsl:text>Unmatched: </xsl:text>
<xsl:value-of select="name(.)"/>
</xsl:message>
<xsl:apply-templates/>
</xsl:template>