[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] loading scripting languages in xslt


Subject: Re: [xsl] loading scripting languages in xslt
From: Steve Ball <Steve.Ball@xxxxxxxxx>
Date: Tue, 18 Jun 2002 07:25:33 +1000

Guilherme Capilé wrote:
is there any simple way to use scripting languages such as php in a xslt
stylesheet?

It would seem that there are different mechanisms to embed several of the leading scripting/programming languages in several of the leading tranformation engines. They differ between implementations. Certainly I know that libxslt has interfaces to Tcl (by yours truly), Perl and Python.

These interfaces allow the scripting language to host a
tranformation, as well as allow extensions to be defined
in the stylesheet to call back into the scripting language.

Some allow script code to be embedded in the stylesheet,
but I don't think that's a good idea (see below).

all I'd like to do is to use it to get the POST data from a form and
send it to a xslt stylesheet as params to update a xml file

That's the job of a framework - the thing that handles the incoming HTTP request and invokes the transformation. The framework should pass the query to the stylesheet as a parameter. I wrote a framework, using Tcl, that constructs a query document in memory and then passed the URI of that document to the stylesheet. The stylesheet simply uses the document() function to retrieve its query document.

Note that a stylesheet may not even know that a scripting language
is involved in its invocation.

> (then I'd
need this scripting language again to write the xml file).

Use EXSLT instead.


In XSLT1.1 I've found a reference to xsl:script, which seems to be what
I am looking for, but I don't know any stable implementation of this
element.

I don't think xsl:script has survived (thank goodness!). There were major objections to it.

My (much) preferred approach is to completely separate the
scripting from the stylesheet, via the XSLT extension mechanism.
This hides the implementation from the stylesheet, which is
important is software engineering.  It allows the extensions
to replaced by some other implementation, without affecting the
stylesheet 'code'.

I don't want to, either, process the xslt with this scripting language.
I'd rather the other way around.

Good thinking.


Cheers,
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
Keywords