[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Regex string function question

Subject: Re: Regex string function question
From: Alexey Gokhberg <alexei@xxxxxxxxxx>
Date: Wed, 24 Jan 2001 12:14:48 +0100
regex string
Michael Kay wrote:
> 
> > Why won't us put a prosal for a standardised [regexp] extension ?
> >
> Doing an extension function that tests whether a string matches a regexp is
> very easy, once you've found a definition of "regular expression" that
> everyone can agree on. An extension function that uses a regexp to extract
> parts of a string is much trickier.
> 

Yes, the design (not implementation) of a general purpose regular
expression facility may be difficult.

Several scripting languages provide excellent specifications for regular
expression facilities. For example, Perl V and ECMAScript (ECMA-262, 3rd
Edition) support regular expressions extensively. The regular expression
syntax in Perl V and ECMAScript is almost the same and could be adopted
for XSLT as well.

Unfortunately, the straightforward port of regular expression facility
into XSLT is uneasy (and probably impossible). The reason is, that
general-purpose regular expression functions like "exec" in ECMAScript
return their results as aggregates, containing various data components
(like array of captured parts of the string). Since XSLT provides no
adequate data type, it is uneasy to express and use results of such
general-puspose functions.

The proposal for XSLT 1.1 is introducing the "object" extension data
type, which could be used to handle complex results. The future XSLT 1.1
processor implementing ECMAScript extensions will automatically provide
full access to ECMAScript regular expression engine. However, some
additional script programming will be required even in XSLT 1.1, since
ECMAScript is object-based while XSLT is not, and a short script will be
needed for mapping plain XSLT functions to object methods in ECMAScript.

As an alternative, the object-based extension mechanism can be
introduced in XSLT. With this mechanism, object-based facilities of
ECMAScript (and other languages) could be accessed directly, without
additional programming. I made few experiments in this direction;
results can be found at

http://www.unicorn-enterprises.com/spec/xslt/xslobj.html


Kind regards,

Alexey Gokhberg
Unicorn Enterprises SA (Switzerland)
http://www.unicorn-enterprises.com

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.