xsl-list
[Top] [All Lists]

RE: both single and double quotes in an XPATH translate()

2005-06-28 12:14:28
The simple way to handle strings containing " and ' is to use an RTF
variable:

<xsl:variable
name="from">'!(_at_)#$%^*(),:;.?/\[]{}|=+-_*"&amp;&gt;&lt;</xsl:variable>

... translate(name, $from, '_______________________')...

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: Arian Hojat [mailto:arianhojat2000(_at_)yahoo(_dot_)com] 
Sent: 28 June 2005 20:07
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] both single and double quotes in an XPATH translate()

Hello all,

I am trying to do a big translate on a string with
special characters like so...

<xsl:value-of select="string( translate(./name, &apos;
'!(_at_)#$%^*(),:;.?/\[]{}|=+-_*&quot;&amp;&gt;&lt;&apos; ,
'________________________________') )" />

But I want to translate both single and double qoutes
in there,
Since the string is delimiting by &apos, I thought I
could use single qoute' in there, but I get an
error...

(Xalan, hav not tested in Saxon yet cause Xalan is the
trouble maker usually for my code)
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException: Prefix must
resolve to a namespace:


I found this useful archived page for what I wanted to
do.
http://www.biglist.com/lists/xsl-list/archives/200107/msg00181.html
but David leaves me hanging with the cliffhanger:
"It gets more interesting when you need both " and '
in the [Xpath] string." :)

Thanks,
Arian


              
__________________________________ 
Yahoo! Mail 
Stay connected, organized, and protected. Take the tour: 
http://tour.mail.yahoo.com/mailtour.html 


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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