Re: [xsl] Question on translate() function

Subject: Re: [xsl] Question on translate() function
From: "Mailing Lists Mail daktapaal@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Sep 2017 10:40:35 -0000
Oh . That makes sense then.. The only place that expression is valid is
when I have something like
translate('ABCDE','')
That replaces a b c d e f to '' ..so in effect it only changes the a and
deletes b c d e so it looks like it is changing ABCDE into space but in
fact it is only changing A and deletes the rest

Thanks ..

On Sep 26, 2017 6:31 AM, "Michael Kay mike@xxxxxxxxxxxx" <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>
> On 26 Sep 2017, at 10:20, Mailing Lists Mail daktapaal@xxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> >>It's valid, but it does something
> >>completely different from what the
> >>user probably intended.
> What does it do ?
>
>
> It replaces every occurrence of "A" by "x", deletes all occurrences of B,
> C, D, and E, and leaves all other characters unchanged.
>
> Michael Kay
> Saxonica
>
>
>
> On Sep 26, 2017 4:32 AM, "Michael Kay mike@xxxxxxxxxxxx" <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>
> > I have seen expressions like :
> > translate($xxx, 'ABCDE','x');
> > which is to say, replace ABCDE with x .. this also works fine
> > is this not valid?
>
> I have seen expressions like this too. It's up there in the list of common
> XPath coding mistakes. It's valid, but it does something completely
> different from what the user probably intended. One of those mistakes you
> make if you guess what a function does from its name, without actually
> reading the spec.
>
> Michael Kay
> Saxonica
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://-list/293509> (by email)
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <-list/1311928> (by
> email <>)

Current Thread