This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: variables/parameters in match of xsl:key, 'ends-with'
- To: "Daniel Bowen" <dbowen2 at qwest dot net>
- Subject: Re: [xsl] variables/parameters in match of xsl:key, 'ends-with'
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Wed, 10 Jan 2001 00:58:34 +0000
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <007701c07a95$ab7dfb90$0610bb82@corp.es.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Daniel,
> As a side note. I sure wish there was an "ends-with" string function in
> addition to the "starts-with" function. I seem to need it much more often
> than "starts-with". I'm imitating "ends-with(source, find)" with
>
> find = substring(source, 1 + string-length(source) - string-length(find))
>
> But for input of several MB., it takes a bit of a hit that it wouldn't if
> there was an 'ends-with' function! (yes, I timed the above with a comparable
> "contains" and "starts-with" variant). Does anyone have a faster way to
> imitate "ends-with"?
Hmm... I wonder if:
contains(source, find) and not(substring-after(source, find))
would be any faster? Which way round the two tests should go (contains
first or substring-after first) probably depends on the XML source -
you might try both.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list