This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: substring function
- From: "Agnes Kielen" <a dot kielen at home dot nl>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 11 Jul 2002 19:24:32 +0200
- Subject: Re: [xsl] substring function
- References: <CF698667C737D41198E50060943F3CF6F682CF@hoexch03.amica.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
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