how to translate quote symbol?
I try to translate(tag, ''', '')
, but it doesn't work. Is it possible to delete or change symbol ' ?
Best rega开发者_如何学Crds.
I find it best to use variables for this:
<xsl:variable name="apos">'</xsl:variable>
<xsl:variable name="quot">"</xsl:variable>
<xsl:value-of select="translate(., $apos, $quot)"/>
Either replace the innermost '
with '
or use quotation marks to delimit a string containing an apostrophe.
I want to offer another answer, because the others didn't work when I use this method. I have solved it in a different way. You should do as this:
<xsl:value-of select='translate(translate(translate(normalize-space(@onclick),"()",""),"'",""),"submitLSthis, product.php?p=","")' />
It should be
select='', not select="",
and
translate(translate(translate(normalize-space(@onclick),"()",""),"'",""),"submitLSthis, product.php?p=","")
not
translate(translate(translate(normalize-space(@onclick),'()',''),''',''),'submitLSthis, product.php?p=','')
I hope this is helpful.
精彩评论