[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Regular expression functions (Was: Re: comments on
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|