The question was answered yesterday.
<xsl:variable name="apos">'</xsl:variable>
<xsl:value-of select="translate(@mystring, $apos, '')"/>
You can also do it without a variable as:
<xsl:value-of select='translate(@mystring, "'", "")'/>
Remember that entity references are expanded before XPath parsing
starts. So you can use entities to represent the quotes used as
attribute delimiters at the XML level, but not to represent the string
delimiters used at the XPath level.
Michael Kay
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Yago Alvarado
Sent: 02 October 2003 09:57
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: [xsl] removing - ' - Is it possible?
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