views:

73

answers:

1

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

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

How it can be made?

+2  A: 
<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.

Tomalak
@Tomalak, Thanks. Only there there is no closing bracket in a line `<xsl:value-of select="normalize-space(substring-after(phone, ')')" />` must be `<xsl:value-of select="normalize-space(substring-after(name, ')'))" />`. It works! Thank you.
Kalinin
@kalininew: You are right. Corrected.
Tomalak