$Id: README.html,v 1.1 2005/11/04 07:27:00 balls Exp $
Revision History | |
---|---|
Revision 3.1 |
Table of Contents
This package provides a Tcl interface to the Gnome libxslt library. The libxslt library is loaded into the Tcl interpeter process. XSL stylesheets are compiled and managed by a Tcl object, so reusing a stylesheet is very fast.
TclXSLT also allows XSLT extensions elements and functions to be implemented as a callback into the application's Tcl code.
See xmlsoft.org/XSLT for more information on the Gnome libxslt library.
See tclxml.sf.net for more information on XML support for Tcl.
Follow these steps:
Install libxml2 and libxslt.
Install TclXML v3.1 with libxml2 support (ie. TclXML/libxml2).
Install TclDOM v3.1 with libxml2 support (ie. TclDOM/libxml2).
Run the configure
script. Various switches may need to be included, namely [--prefix], [--exec-prefix], [--enable-threads], [--with-libxml2-include], [--with-libxml2-lib], [--with-libxslt-include], [--with-libxslt-lib], [--with-libexslt-include], [--with-libexslt-lib]
For example, on my Linux system I have Tcl 8.4 installed (with threads) in /usr/local/tcl8.4
and libxml2 and libxslt installed in /usr/local
so I would use the command:
./configure --prefix=/usr/local/tcl8.4 --enable-threads --with-libxml2-include=/usr/local/include --with-libxml2-lib=/usr/local/lib --with-libxslt-include=/usr/local/include --with-libxslt-include=/usr/local/lib --with-libexslt-include=/usr/local/include --with-libexslt-include=/usr/local/lib
make
make install
You may have to do this as root.
Here's a quick start:
package require dom 3.1 package require xslt 3.1 # First use the TclDOM package to parse the # source and stylesheet documents. set source [dom::parse $sourcexml] # NB. Specifying -baseuri is a good idea set styledoc [dom::parse $stylexml] # Now create the stylesheet set stylesheet [xslt::compile $styledoc] # Now apply the transformation. # The return result is a TclDOM document. # Parameters may be supplied as additional arguments. set result [$stylesheet transform $source name 'value'] # Use TclDOM to serialize the result document. set resultxml [dom::serialize $result]