Re: [xsl] Tokenize followed by compare or satisfies using contains()?

Subject: Re: [xsl] Tokenize followed by compare or satisfies using contains()?
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 2 Sep 2016 21:47:48 -0000
On Fri, Sep 02, 2016 at 09:38:07PM -0000, Eliot Kimber ekimber@xxxxxxxxxxxx scripsit:
> In the specific DITA case you're searching for strings reliably bound by
> blanks, so the contains is correct in this case.
> 
> Your statement "Intrinsically, tokenizing is more complex than just
> searching for a substring." is I think what I was looking for--that
> suggests that as a general policy that preferring contains() over tokenize
> and sequence comparison will be the better choice if performance is the
> only concern (and assuming that it actually produces a meaningful
> performance difference, which it very well may not).

If you're seriously concerned about performance, generate a list of the
known @class values, stick it in an XML structure in a variable,
and use key() to look stuff up in it.  That risks requiring regularizing
the @class spaces first but it also means you only have to worry about
decomposing the @class when it's an unknown value and the fallback is
required.

-- Graydon

Current Thread