我需要能够替换某些字符,以便我可以将它们用作 CSS 类。
我有诸如类(名称)、类名之类的字符串,这些字符串不是有效的 CSS 类(据我所知)。
如何使用替换功能来替换多个字符,
E.g.
translate(className, ' ','') (would replace a space)
但是可以对多个角色执行此操作吗?
翻译似乎不适用于 &
Example
XML
<title>Mary & the Wolf<title>
XSLT
<xsl:value-of select="translate(title, ' &','')"/></xsl:attribute>
所以我希望输出是:
MarytheWolf
但目前我遇到了 & 字符错误。
translate()
按字符工作:
translate(className, ' &#?!','') // would remove any character in the string #1
or
translate(className, ' &#?!','_____') // would replace any character
// in the string #1 with '_'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)