[xsl] substring function

Subject: [xsl] substring function
From: "CROFT, MICHAEL" <MCROFT@xxxxxxxxx>
Date: Thu, 11 Jul 2002 11:16:06 -0400
I am trying to format a phone number, which may contain an extension....

Here is the node: 
<WorkPhoneNumber>1234567890x333</WorkPhoneNumber>

I am trying to get: (123) 456-7890 x333
In the output (html)

here is my test:

<xsl:if test="string(WorkPhoneNumber)">
<xsl:value-of select="concat('(',substring(WorkPhoneNumber,1,3),')
',substring(WorkPhoneNumber,4,3),'-',substring(WorkPhoneNumber,7,4),substrin
g-after(WorkPhoneNumber, 'x'))"/>
</xsl:if>

This results in: 
(123) 456-7890

Ive also tried this...
<xsl:if test="string(WorkPhoneNumber)">
						<xsl:value-of
select="concat('(',substring(WorkPhoneNumber,1,3),')
',substring(WorkPhoneNumber,4,3),'-',substring(WorkPhoneNumber,7,4),substrin
g(WorkPhoneNumber, 10))"/>
					</xsl:if>

which results in this:

(123) 456-788909090909008080

Im not sure what is happening...

Mike


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender and postmaster@xxxxxxxxxx
**********************************************************************
 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread