Subject: RE: removing - ' - Is it possible?
From: "Sergiu Ignat" <sergiu@xxxxxxxxxx>
Date: Thu, 2 Oct 2003 12:19:40 +0300
|
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,''','')"/> 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
|