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

Re: Regular expression functions (Was: Re: comments on

Subject: Re: Regular expression functions (Was: Re: comments on December F&O draft)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 8 Jan 2002 16:11:11 GMT
xsl match position match jscript
> From some JScript documentation:

jscript> w'assat:-) sed's the thing (or emacs lisp:-)

> I agree with your analysis about regexp replace in general, though
> it's not altogether useless - when global, at least it goes some way
> towards helping with the classic multi-string-replacement problem. For
> example, to escape newline characters with "\n", tabs with "\t" and
> carriage returns with "\r":

but usually replace threads go

1) how to I replace a by b

2) to which you give a recursive template answer 

3) then the original responder comes back and says

4) oh yes but actually I also want to replace b by c and d by the chunk of
   XML that's in file abc.xml....

If you're going go add regexp support I don't think two functions and a
paragraph of text in F&O is enough. "If a job's worth doing it's worth
doing well" as my mum always said (not that I ever believed her:-)

> I think that you need a sequence of match positions *and lengths* in

ah yes well emacs match position data has beginning and end positions,
but beginnings and lengths would do:-)

> how do you define the scope, for one thing?
they'd be template-local variables 

<xsl:apply-regexp-templates-to-string select="text()"/>


<xsl:regexp-template match="\sqrt{([^{}]*)}">
<xsl:apply-regexp-templates-to-string select="$1"/>

<xsl:regexp-template match="\gamma">


\gamma + \sqrt{\gamma} 

goes in

<mi>&#947;</mi> + <msqrt><mi>&#947;</mi></msqrt>

comes out (a first approximation to a tex->mathml conversion)


This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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

Current Thread


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.
First Name
Last Name
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.