xsl-list
[Top] [All Lists]

RE: Re: removing - ' - Is it possible?

2003-10-02 02:22:36
Thanks Dimitre!

   Simple and effective!


Regards,
Yago

-----Original Message-----
From: Dimitre Novatchev [mailto:dnovatchev(_at_)yahoo(_dot_)com]
Sent: 02 October 2003 10:28
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Re: removing - ' - Is it possible?


This MUST be possible...the case is HOW?

Like this:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:output method="text"/>

  <xsl:variable name="Q">'</xsl:variable>
  <xsl:variable name="str">a'b'c'd</xsl:variable>

  <xsl:template match="/">
    <xsl:value-of select="translate($str, $Q, '')"/>
  </xsl:template>
</xsl:stylesheet>

When this transformation is applied on any source.xml (not 
used) the wanted
result is produced:
abcd


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL



"Yago Alvarado" <Yago(_dot_)Alvarado(_at_)uk(_dot_)cpm-int(_dot_)com> wrote 
in message
news:E37A8B2D6B01174384DC428A78647A961346DC(_at_)tm-exch(_dot_)cpm-int(_dot_)com(_dot_)(_dot_)(_dot_)
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



<Prev in Thread] Current Thread [Next in Thread>