RE: [xsl] removing - ' - Is it possible?

Subject: RE: [xsl] removing - ' - Is it possible?
From: Yago Alvarado <Yago.Alvarado@xxxxxxxxxxxxxx>
Date: Thu, 2 Oct 2003 10:28:29 +0100
Hi Sergiu!

The translate function can be used to remove characters. The only thing
you have to do is to stick all the characters you want to remove int
the second parameter of the function and leave the third parameter empty.

example:

translate(@mystring,'abc','')

this function would remove all the 'a','b','c' characters from the @mystring
attribute.


Regards,
Yago

> -----Original Message-----
> From: Sergiu Ignat [mailto:sergiu@xxxxxxxxxx]
> Sent: 02 October 2003 10:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] removing - ' - Is it possible?
> 
> 
> Hi Yago.
> You have two problems:
> 1. translate() function replaces one character with another character.
> You can replace one character with white space, but you can't 
> remove a character.
> 
> 2. To remove character use one of "replace-string" templates 
> offered by list members at:
> http://www.dpawson.co.uk/xsl/sect2/sect21.html look at 
> "Replace" link. I can't get it.
> 
> To send a parameter that contains a special character look at:
> http://www.dpawson.co.uk/xsl/sect2/N7150.html#d7104e577
> A Michael Kay article.
> 
> And another tip. Use FAQ and archives. Similar problems where 
> discussed yesterday.
> 
> Ceers.
> Sergiu
> 
> > Hi list!
> > 
> >    I wanted to remove all the apostrophes ' from a string.
> > 
> >    My first idea was using the translate function... i.e. 
> > 
> > <xsl:value-of select='translate(@mystring,''','')'/>
> > 
> > Unfortunately this didn't work, I get the error.
> > 
> > ERROR: Required white space was missing.
> > 
> > 
> > So I thought that maybe using different quotes I would be 
> > able to achieve 
> > the result I was after, so I tried:
> > 
> > <xsl:value-of select='translate(@mystring,"'","")'/> and I 
> > got the same
> > error as before.
> > 
> > <xsl:value-of select="translate(@mystring,''','')"/> ERROR: 
> > Description:
> > Expected token ')' found 'STRING'.
> > 
> > At this point I thought...well, let's try using the unicode 
> > number rather
> > than the symbol...
> > so I tried
> > <xsl:value-of select="translate(@mystring,'&#x27;','')"/> ERROR:
> > Description: Expected token ')' found 'STRING'.
> > 
> > I tried a few more variations with the same frustraiting result...
> > 
> > At this point I had to accept the fact that ... this is 
> > *probably* not the
> > way to achive what I want...
> > so after a quick search in the faq and the archives I decided 
> > to ask to the
> > list and see if anyone has
> > faced a similar situation in the past...
> > 
> > 
> > This MUST be possible...the case is HOW?
> > 
> > Regards,
> > Yago Alvarado
> > 
> > 
> _____________________________________________________________________
> > This e-mail is confidential and is intended solely for the 
> > use of the individual or entity to whom it is addressed.  If 
> > you are not the intended recipient and you have received this 
> > e-mail in error then any use, dissemination, forwarding, 
> > printing or copying of this e-mail is strictly prohibited. 
> > You should contact the sender by return e-mail and delete and 
> > destroy all the information from your system.  Any views or 
> > opinions presented are solely those of the author and do not 
> > necessarily represent those of CPM UK Limited.  This email 
> > does not form part of a legally binding agreement.  We have 
> > taken precautions to minimise the risk of transmitting 
> > software viruses or trojans, but we advise that you carry out 
> > your own virus checks on any attachments to this message.  We 
> > cannot accept liability for any loss or damage caused to your 
> > software, hardware or system.
> > 
> > Please note that all messages sent to CPM UK Limited are 
> > actively monitored for inappropriate material and/ or content.
> > 
> > More information about CPM can be found at our website at: 
> http://www.cpm-int.com
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> _____________________________________________________________________
> This e-mail has been scanned for viruses by MessageLabs.
> 

_____________________________________________________________________
This e-mail is confidential and is intended solely for the use of the individual or entity to whom it is addressed.  If you are not the intended recipient and you have received this e-mail in error then any use, dissemination, forwarding, printing or copying of this e-mail is strictly prohibited. You should contact the sender by return e-mail and delete and destroy all the information from your system.  Any views or opinions presented are solely those of the author and do not necessarily represent those of CPM UK Limited.  This email does not form part of a legally binding agreement.  We have taken precautions to minimise the risk of transmitting software viruses or trojans, but we advise that you carry out your own virus checks on any attachments to this message.  We cannot accept liability for any loss or damage caused to your software, hardware or system.

Please note that all messages sent to CPM UK Limited are actively monitored for inappropriate material and/ or content.

More information about CPM can be found at our website at: http://www.cpm-int.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread