XSL - 用另一个字符替换管道
XSL - Replace pipe by another character
我使用 XSLT 2。如何用另一个字符替换管道?
例如我有这样一个元素:
<list items="A1|A2|A3"/>
我想要
<list items="A1,A2,A3"/>
我试过类似的东西,但没有用
<xsl:variable name="result" select="replace(list/@items, '|', ',')"/>
有什么问题?
replace()
函数使用正则表达式 - 竖线字符是正则表达式中的特殊字符。转义字符:
<xsl:variable name="result" select="replace(list/@items, '\|', ',')"/>
或改用 translate()
函数。
我使用 XSLT 2。如何用另一个字符替换管道?
例如我有这样一个元素:
<list items="A1|A2|A3"/>
我想要
<list items="A1,A2,A3"/>
我试过类似的东西,但没有用
<xsl:variable name="result" select="replace(list/@items, '|', ',')"/>
有什么问题?
replace()
函数使用正则表达式 - 竖线字符是正则表达式中的特殊字符。转义字符:
<xsl:variable name="result" select="replace(list/@items, '\|', ',')"/>
或改用 translate()
函数。