电话号码转换。括号中的分隔前缀

发布于 2024-08-29 11:44:26 字数 157 浏览 3 评论 0原文

有一个元素:(987) 123-45-67

需要将其转换为:(987) 123-45-67

它是如何制作的?

There is an element: <phone>(987) 123-45-67</phone>.

It is necessary to transform it in: <span><small>(987)</small> 123-45-67</span>.

How it can be made?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只是一片海 2024-09-05 11:44:26
<span>
  <small>
    <xsl:value-of select="concat(substring-before(phone, ')'), ')')" />
  </small>
  <xsl:text> </xsl:text>
  <xsl:value-of select="normalize-space(substring-after(phone, ')'))" />
</span>

上述方法不适用于与您显示的格式不同的电话号码。添加一些您自己的健全性检查,以确保电话号码采用您期望的格式。

<span>
  <small>
    <xsl:value-of select="concat(substring-before(phone, ')'), ')')" />
  </small>
  <xsl:text> </xsl:text>
  <xsl:value-of select="normalize-space(substring-after(phone, ')'))" />
</span>

The above won't work for phone numbers in any different format than the one you show. Add some sanity checking of your own to ensure the phone number is in the format you expect.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文