开发者

Phone number transformation. Separate prefix in brackets

There is an element: <phone>(987) 123-45-67</pho开发者_开发知识库ne>.

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

How it can be made?


<span>
  <small>
    <xsl:value-of select="concat(substring-before(phone, ')'), ')')" />
  </small>
  <xsl:text>&#160;</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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜