[xslt] patch set implementing func:script



Hello,

This email is going to be long, so please bare with
me.

Here is a patch set for implementing EXSLT func:script
tag
with support for JavaScript.
>From quite some time I've had that wish to have such a
functionality
in C. This is a such implementation and now I'm
posting it for feedback.
I opted for having it done EXSLT compliant rather than
developing a new address space.

Design:
Solution is fairly simple. There is an universal
interface "C scripting
framework" aka CSF which binds EXSLT and language
adaptations.
Those of you familiar with Xalan-J and BSF would find
it rather 
similar.
In order to get CSF done some extensions to EXSLT were
necessary.
Currently I've done JavaScript support for Mozilla's
SpiderMonkey 
engine.
Most probably I'll add Python and BASH support in
future.
These language adaptations are static i.e. known at
compile time.
Currently I've put all new sources in libexslt but
this could change.
Installation and usage are described bellow.

Current patch set is against:
	libxml2-2.5.11
	libxslt-1.0.33
	js 1.5 (beta) (Mozilla's SpiderMonkey)

Usage:
Have a look at the new test case
tests/exslt/functions/function.7.

Installation:
Get sources for all three libraries (compiling libxml
is optional).
Compile js: 
	setenv BUILD_OPT 1
	cd src
	gmake -f Makefile.ref
Compile libxml2 as you wish.
Patch libxslt with attached files (patch -p1). Leave
exslt-csf.patch
for after configure because currently it patches the
Makefile.
Compile libxslt:
	setenv LIBXML2_DIR ~/tmp/xml/libxml2-2.5.11
	setenv JS_DIR ~/tmp/xml/js
	setenv JS_BUILD HP-UXB.11.00_OPT.OBJ
	setenv CFLAGS "-I$JS_DIR/src -I$JS_DIR/src/$JS_BUILD"
	setenv LDFLAGS "$JS_DIR/src/$JS_BUILD/libjs.a" <--for
static build
	setenv LDFLAGS "-L$JS_DIR/src/$JS_BUILD -ljs"  <--for
dynamic build
	setenv LD_LIBRARY_PATH "$JS_DIR/src/$JS_BUILD"
<--under Linux
	./configure --without-debug --without-pic
--disable-shared \ <--static 
build
		--with-libxml-src=$LIBXML2_DIR
	patch -p1 < exslt-csh.patch
	gmake
After that executable libxslt/xsltproc/xsltproc is
func:script enabled 
with 
a javascript support.
Run test case 7 to see how it works: xsltproc
function.7.xsl 
function.7.xml

Open issues:
Configure needs to be extended with new options.
JS adaptation do need some of the functions from js.c
such as print(), gc() and etc.
Currently supported by JS adaptation data types are:
string and number.
XSLT says about boolean, Node and NodeSet too but
currently they are 
not
implemented.

Results:
I've being testing it under HP-UX, FC2 and RH9 all
without problems.
SpiderMonkey does support JS1.5 fairly fine, I haven't
encountered any
probems in that area.
Compared to jre1.3-XalanJ-Rhino speedup is about x2/x3
on average (hpux).
JS impact doesn't seems much, for my apps it meassure
about 1/3
of total time.

Give it a try and let me know what do you think.
Niki

Patch set:
There are few groups of changes:
- configure       --> I had to patch it in order to
get LD_LIBRARY_PATH
                      properly used in configure phase
- libxslt
	variables.c --> allows to set multiple times one and
same variable
                      this is rather useful when do
some scripting and 
call
                      different routines without
defining new variables
	functions.c --> xpath function lookup now also
delegates to user 
                      defined lookup function if such
is defined
	extensions.h,c --> minor improvements to extension
support
- libexslt and csf related
	functions.c --> func:script handling added
      makefile    --> 
	csf.h,c     --> interfaces and factory methods of CSF
                      available language adaptations
(.c) are 
#include-ed
			   by csf.c in order to localize #ifdef constructs
- spider monkey adaptaion
	embedded_js.c --> js adaptation with embedded js
engine
- tests           --> test case for the new functionality


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

Attachment: configure-ldlibrarypath.patch
Description: configure-ldlibrarypath.patch

Attachment: csf-core.patch
Description: csf-core.patch

Attachment: exslt-csf.patch
Description: exslt-csf.patch

Attachment: exslt-tests.patch
Description: exslt-tests.patch

Attachment: js-csf.patch
Description: js-csf.patch

Attachment: xslt-extensions.patch
Description: xslt-extensions.patch



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]