[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

substring function

Subject: substring function
From: "CROFT, MICHAEL" <MCROFT@xxxxxxxxx>
Date: Thu, 11 Jul 2002 11:16:06 -0400
substring function
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.