xsl-list
[Top] [All Lists]

Re: [xsl] Question on translate() function

2017-09-26 05:31:57

On 26 Sep 2017, at 10:20, Mailing Lists Mail daktapaal(_at_)gmail(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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(_at_)saxonica(_dot_)com 
<mailto:mike(_at_)saxonica(_dot_)com>" 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com 
<mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>> 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 <-list/293509> (by email <>)
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>