[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: Regular expression functions (Was: Re: [xsl] comments on December F&O draft)
Subject: Re: Regular expression functions (Was: Re: [xsl] comments on December F&O draft) From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 8 Jan 2002 16:11:11 GMT |
> 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{([^{}]*)}"> <msqrt> <xsl:apply-regexp-templates-to-string select="$1"/> </msqrt> </xsl:regexp-template> <xsl:regexp-template match="\gamma"> <mi>γ</mi> </xsl:regexp-template> .... \gamma + \sqrt{\gamma} goes in <mi>γ</mi> + <msqrt><mi>γ</mi></msqrt> comes out (a first approximation to a tex->mathml conversion) David _____________________________________________________________________ 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Regular expression functions (W, Jeni Tennison | Thread | Re: Regular expression functions (W, Jeni Tennison |
Re: [xsl] XPath 2.0, Jeni Tennison | Date | Re: [xsl] XPath 2.0, Miloslav Nic |
Month |
Keywords