Re: [xsl] Remove text Up to Full Stop

Subject: Re: [xsl] Remove text Up to Full Stop
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 22 Aug 2005 11:28:19 +0100
> This is slightly off-topic, but does anyone know why there is no
> string function in XSL that does what the "last-index-of" Java String
> function does?

xslt (1) has essentially no functions for parsing strings
(up-translation in omnimark-speak) it's world view is that input data is
fully tagged and all information in the source is marked up with xml
eleemnts and attributes and the job is to down-size that input for later
consumption.

It does have substring, substring-before and substring-after but they
aren't really up to the job (although I did once write a fairly full tex
maths parser including matching brace groups {... {...}} just using
that, but it was fairly painful.)

The usage of XSLT doesn't really fit the world view of that original
design, and xslt2 does have a lort more functionality in this area
including regular-expression-replace, which does the job in a single
function call in this case.

> A recursive function seems rather
> slow for this kind of (common) operation.

It's just syntax. If an idiom is used often enough, there's no saying
what run-time code results (or how long it takes) once the compiler
optimiser has finished jiggling the code.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread