Re: [xsl] Call perl script within xsl?

Subject: Re: [xsl] Call perl script within xsl?
From: Steve Ball <Steve.Ball@xxxxxxxxx>
Date: Tue, 29 Jan 2002 11:59:35 +1100
Sabrina Fords wrote:

Can you call a perl script within xsl?


Firstly, you don't say why you want to call Perl from XSLT.
That may help refine exactly what help you need
(it may be the case that what you are endeavouring to do
can be achieved using XSLT alone).

I don't use Perl (thank God!), but I've written an interface
to the Tcl scripting language from the Gnome libxslt library
called TclXSLT.  Apart from being able to invoke an XSLT
transformation from Tcl, this package also allows the XSLT
stylesheet to call into Tcl code (and Tcl can then call
C/C++/whatever).  See http://tclxml.sf.net/tclxslt.html
for more information (but bear in mind that the Web page
is very incomplete at the moment).

Now, the point of my telling you this is that the way
in which this occurs is important.  TclXSLT hides the
scripting from the stylesheet by using extension elements
and functions.  This encourages portability of your
stylesheet, and IMO actually makes writing both the
XSLT stylesheet and scripts easier (since the interfaces
must be well-defined).  Think of EXSLT; it doesn't matter
whether the XSLT processor is implemented using Java or C,
your stylesheet is portable.

However, I've seen some examples of AxKit where the Perl
code appears embedded inside the stylesheet.
I believe that's bad.  Keep the XSLT stylesheet and the
scripting separate, and connect them together using extensions.

HTHs,
Steve Ball

--
Steve Ball            |   XSLT Standard Library   | Training & Seminars
Zveno Pty Ltd         |     Web Tcl Complete      |   XML XSL Schemas
http://www.zveno.com/ |      TclXML TclDOM        | Tcl, Web Development
Steve.Ball@xxxxxxxxx  +---------------------------+---------------------
Ph. +61 2 6242 4099   |   Mobile (0413) 594 462   | Fax +61 2 6242 4099


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread