【问题标题】:XSLT / XPath function to remove trailing charactersXSLT/XPath 函数去除尾随字符
【发布时间】:2016-01-27 10:56:12
【问题描述】:

我有一种情况,我在 XForm 中显示一个地址,这个地址是预先格式化的,但偶尔会包含几个尾随逗号,我需要删除它们。

这是我的代码:

    <xf:output id="Address-control" ref="$Address" >
        <xf:label>GP Address</xf:label>
    </xf:output>

其中,有时会产生如下输出:

 My House, My Road, My Town, , , , ,

我需要一些东西来去掉结尾的逗号,这样输出就变成了:

 My House, My Road, My Town

提前致谢

【问题讨论】:

    标签: xslt xpath orbeon xforms


    【解决方案1】:

    使用replace($Address, '[\s,]+$', '') 应该删除任何尾随空格和逗号的组合。

    【讨论】:

    • 像魅力一样工作!谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-15
    • 1970-01-01
    • 2010-12-23
    • 1970-01-01
    • 2014-09-02
    • 2011-08-28
    相关资源
    最近更新 更多