The formattelnr() function

Smartsite 7.8 - ...

The formattelnr() extension function formats an Dutch telephone number.

XML CopyCode image Copy Code
string exf:formattelnr(arg1, string typeFormat)

Parameters:

  • arg1: a node reference or string literal, containing the telephone number to format.
  • string typeFormat: a string indicating how to format the telephone number:
    NLSTREEP, NLSPATIE, NLHAAKJES, NLSTREEPPLUS, NLSPATIEPLUS, NLHAAKJESPLUS

Example

XML CopyCode image Copy Code
<html xmlns="http://www.w3.org/1999/xhtml" 
  xmlns:xf="http://www.w3.org/2002/xforms" 
  xmlns:exf="http://smartsite.nl/namespaces/xforms/1.0" >
 <head>
  <title>Example</title>
  <xf:model>
   <xf:instance>
    <data xmlns="">     
    </data>
   </xf:instance>
  </xf:model>
 </head>
 <body>
  <xf:group ref="/data" appearance="full">
   <xf:label/>
   <xf:output value="exf:formattelnr('0152513700', 'NLSTREEP')" />
   <xf:output value="exf:formattelnr('0152513700', 'NLSPATIE')" />
   <xf:output value="exf:formattelnr('0152513700', 'NLHAAKJES')" />
   <xf:output value="exf:formattelnr('+31152513700', 'NLSTREEP')" />
   <xf:output value="exf:formattelnr('+31152513700', 'NLSPATIE')" />
   <xf:output value="exf:formattelnr('+31152513700', 'NLHAAKJES')" />
   <xf:output value="exf:formattelnr('+31152513700', 'NLSTREEPPLUS')" />
   <xf:output value="exf:formattelnr('+31152513700', 'NLSPATIEPLUS')" />
   <xf:output value="exf:formattelnr('+31152513700', 'NLHAAKJESPLUS')" />
  </xf:group>
 </body>
</html>

The result will be:

015-2513700
015 2513700
(015) 2513700
015-2513700
015 2513700
(015) 2513700
+31 15-251 37 00
+31 15 251 37 00
+31 (15) 251 37 00

Namespace

This function is available within the Smartsite XForms namespace (http://smartsite.nl/namespaces/xforms/1.0).