README
1
2 XSLT For Tcl
3
4 A Tcl wrapper for the Gnome libxslt library Version 2.6
5
6Steve Ball, Zveno Pty Ltd
7
8This package provides a Tcl interface to the Gnome libxslt library
9[http://xmlsoft.org/XSLT/]. The libxslt library is loaded into the Tcl
10interpeter process. XSL stylesheets are compiled and managed by a Tcl object,
11so reusing a stylesheet is very fast.
12
13TclXSLT also allows XSLT extensions elements and functions to be implemented as
14a callback into the application's Tcl code.
15
16See xmlsoft.org/XSLT [http://xmlsoft.org/XSLT/] for more information on the
17Gnome libxslt library.
18
19See tclxml.sf.net [http://tclxml.sourceforge.net/] for more information on XML
20support for Tcl.
21
22
23
24Installation
25============
26
27Follow these steps:
28
29Install libxml2 and libxslt.
30
31Install TclXML v2.6.
32
33Install TclDOM v2.6 with libxml2 support.
34
35Run the configure script. Various switches may need to be included, namely
36--prefix, --exec_prefix, --enable-threads, --with-xml2-include,
37--with-xml2-lib, --with-libxslt-include, --with-libxslt-lib,
38--with-libexslt-include, --with-libexslt-lib
39
40For example, on my Linux system I have Tcl 8.4 installed (with threads) in
41/usr/local/tcl8.4 and libxml2 and libxslt installed in /usr/local so I would
42use the command:
43
44 ./configure --prefix=/usr/local/tcl8.4 --exec-prefix=/usr/local/tcl8.4 --enable-threads --with-xml2-include=/usr/local/include --with-xml2-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
45
46 make
47
48 make install
49
50You may have to do this as root.
51
52
53
54Usage
55=====
56
57Here's a quick start:
58
59
60 package require dom 2.6
61 package require xslt 2.6
62
63 # First use the TclDOM package to parse the
64 # source and stylesheet documents.
65
66 set source [dom::libxml2::parse $sourcexml]
67
68 # NB. Specifying -baseuri is a good idea
69 set styledoc [dom::libxml2::parse $stylexml]
70
71 # Now create the stylesheet
72
73 set stylesheet [xslt::compile $styledoc]
74
75 # Now apply the transformation.
76 # The return result is a TclDOM document.
77 # Parameters may be supplied as additional arguments.
78
79 set result [$stylesheet transform $source name 'value']
80
81 # Use TclDOM to serialize the result document.
82
83 set resultxml [dom::libxml2::serialize $result]
84
85
86
87
88Extensions
89==========
90
91See test/extension.test
92
93 for a demonstration of how to implement an extension
94function as a Tcl callback.
95
96
97
README.html
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>XSLT For Tcl</title><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id222773"></a>XSLT For Tcl</h1></div><div><h3 class="subtitle"><i>A Tcl wrapper for the Gnome libxslt library</i></h3></div><div><div class="author"><h3 class="author"><span class="firstname">Steve</span> <span class="surname">Ball</span></h3><div class="affiliation"><span class="orgname">Zveno Pty Ltd<br></span><div class="address"><p><br>
2 ��<span class="otheraddr"><br>
3 ����<a href="http://www.zveno.com/" target="_top">www.zveno.com</a><br>
4 ��</span><br>
5 </p></div></div></div></div><div><p class="releaseinfo">$Id: README.xml,v 1.1 2003/03/09 11:30:42 balls Exp $</p></div><div><div class="revhistory"><table border="1" width="100%" summary="Revision history"><tr><th align="left" valign="top" colspan="2"><b>Revision History</b></th></tr><tr><td align="left">Revision 2.6</td><td align="left"></td></tr></table></div></div></div><div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#id268595">Installation</a></dt><dt><a href="#id269023">Usage</a></dt><dt><a href="#id269054">Extensions</a></dt></dl></div><p>This package provides a Tcl interface to the <a href="http://xmlsoft.org/XSLT/" target="_top">Gnome libxslt library</a>. 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.</p><p>TclXSLT also allows XSLT extensions elements and functions to be implemented as a callback into the application's Tcl code.</p><p>See <a href="http://xmlsoft.org/XSLT/" target="_top">xmlsoft.org/XSLT</a> for more information on the Gnome libxslt library.</p><p>See <a href="http://tclxml.sourceforge.net/" target="_top">tclxml.sf.net</a> for more information on XML support for Tcl.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id268595"></a>Installation</h2></div></div><div></div></div><p>Follow these steps:</p><div class="orderedlist"><ol type="1"><li><p>Install libxml2 and libxslt.</p></li><li><p>Install TclXML v2.6.</p></li><li><p>Install TclDOM v2.6 with libxml2 support.</p></li><li><p>Run the <tt class="filename">configure</tt> script. Various switches may need to be included, namely [--prefix], [--exec_prefix], [--enable-threads], [--with-xml2-include], [--with-xml2-lib], [--with-libxslt-include], [--with-libxslt-lib], [--with-libexslt-include], [--with-libexslt-lib]</p><p>For example, on my Linux system I have Tcl 8.4 installed (with threads) in <tt class="filename">/usr/local/tcl8.4</tt> and libxml2 and libxslt installed in <tt class="filename">/usr/local</tt> so I would use the command:</p><pre class="programlisting">/configure --prefix=/usr/local/tcl8.4 --exec-prefix=/usr/local/tcl8.4 --enable-threads --with-xml2-include=/usr/local/include --with-xml2-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</pre></li><li><pre class="programlisting">make</pre></li><li><pre class="programlisting">make install</pre><p>You may have to do this as root.</p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id269023"></a>Usage</h2></div></div><div></div></div><p>Here's a quick start:</p><pre class="programlisting">
6package require dom 2.6
7package require xslt 2.6
8
9# First use the TclDOM package to parse the
10# source and stylesheet documents.
11
12set source [dom::libxml2::parse $sourcexml]
13
14# NB. Specifying -baseuri is a good idea
15set styledoc [dom::libxml2::parse $stylexml]
16
17# Now create the stylesheet
18
19set stylesheet [xslt::compile $styledoc]
20
21# Now apply the transformation.
22# The return result is a TclDOM document.
23# Parameters may be supplied as additional arguments.
24
25set result [$stylesheet transform $source name 'value']
26
27# Use TclDOM to serialize the result document.
28
29set resultxml [dom::libxml2::serialize $result]
30</pre></div><div xmlns:ns1="" class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id269054"></a>Extensions</h2></div></div><div></div></div><ns1:p>See </ns1:p><p>test/extension.test</p><ns1:p> for a demonstration of how to implement an extension function as a Tcl callback.</ns1:p></div></div></body></html>
31