开发者

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 &apos; 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),"()",""),"&apos;",""),"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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜