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

Re: substring function

Subject: Re: substring function
From: "Agnes Kielen" <a.kielen@xxxxxxx>
Date: Thu, 11 Jul 2002 19:24:32 +0200
Re:  substring function
Hi Michael,
I don't get it. When I try your first 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>

I get this: (123)456-7890333
You don't get an 'x' because you ask for the characters after the 'x'. So I
changed it into:
<xsl:if test="string(WorkPhoneNumber)">
<xsl:value-of

select="concat('(',substring(WorkPhoneNumber,1,3),')',substring(WorkPhoneNum
ber,4,3),'-',substring(WorkPhoneNumber,7,4),'x',substring-after(WorkPhoneNum
ber, 'x'))"/>
</xsl:if>

and got with this input:
<WorkPhoneNumber>1234567890x333</WorkPhoneNumber>
the following result:
(123)456-7890x333

I didn't check your second try. Hopes this helps, but not sure.

Agnes



 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.