[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: [xsl] Re: removing - ' - Is it possible?
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Thu, 2 Oct 2003 11:28:27 +0200

> 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.Alvarado@xxxxxxxxxxxxxx> wrote in message
news:E37A8B2D6B01174384DC428A78647A961346DC@xxxxxxxxxxxxxxxxxxxxxx
> 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



Current Thread
Keywords