RE: Questioning XSL

Subject: RE: Questioning XSL
From: "Didier PH Martin" <martind@xxxxxxxxxxxxx>
Date: Fri, 21 May 1999 21:35:06 -0400
Hi Paul,

You've given me only pattern matching. In JavaScript, Python or Perl I
would have to write the polymorphic dispatch engine myself and likely
write my output templates in some weird non-XML syntax:

make( "HTML" ) or write( "<HTML>" ) or something.

Even if what you say is true on most script languages. It is however
possible to use these script languages differently. Take for example python
script (I know you like this language ;-). You have a version packaged as
active script. For all that think that this is Microsoft stuff and start
getting allergic reactions take Advil :-))). So, basically, this interface
(which by the way also work with minor modification as a XPCOM module) could
be called for a particular procedure or function. So, if you have a XML
parser that for each element, calls a particular procedure, you then have a
similar event driven script as you would have with the event driven language
family or pattern match family (XSL, DSSSL, etc..) then, for example, to
associate a particular procedure to a particular element:

function baba(current_node) <- baba is a XML element
  your procedure body here

You can do this kind of mechanism with:
a) python
b) Perl
c) Ecma script
d) vb script

Some could be ported on different platforms (with XPCOM help) some cannot
(like VBscript for obvious reasons)
So, the constructs or rules would be more like Omnimark. A drawback compared
to XSL (the rich XSL pattern matching and functional character). An
advantage: suited for processing incoming XML documents like for e-commerce
(i.e.. the procedure body can access a data base).
The point here is that, if the script language is packaged as a component in
a certain way, a parser can be used as an even trigger that calls procedures
or functions. Simply a different possible approach possible today with some
popular script languages. You don't necessarily need to include in the
script language a loop (switch like) or a particular procedure to dispatch
the control to the right rule/procedure.

pattern = compilePattern( "B" )
function B_template( current_node ){

		make_element( "BOLD", 
			dispatch_children( current_node )))

xsl_engine.add( pattern, B_template )

Paul, your library looks promising, nice construct.

Didier PH Martin

 XSL-List info and archive:

Current Thread