Subject: Re: [xsl] Regex string function question From: Alexey Gokhberg <alexei@xxxxxxxxxx> Date: Wed, 24 Jan 2001 12:14:48 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Regex string function que, Alexey Gokhberg | Thread | RE: [xsl] Regex string function que, Michael Kay |
RE: [xsl] Regex string function que, Rick Anderson | Date | Re: [xsl] Getting the deepest node , David Carlisle |
Month |