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> 123-45-67</span>
.
How it can be made?
<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.
精彩评论