[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: format-number() for a phone number?


Subject: RE: format-number() for a phone number?
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Thu, 27 May 1999 10:54:03 -0600

David Carlisle wrote:
> you can do it within XSLT. the following inserts -
> into strings of digits, you should be able
> to modify it easily enough to insert () as well.
> 
> [...]
>     <xsl:when test="starts-with($left,'0')">
>       <xsl:text>0</xsl:text>
>       <xsl:call-template name="ssn-dash">
>         <xsl:param name="count" expr="$count+1"/>
>         <xsl:param name="left" expr="substring-after($left,'0')"/>
>       </xsl:call-template>
> [...]

Whee! Thanks, David.

Well since format-number() isn't behaving as expected in XT (any comments on
that?), I tried this method. Ugly as it is, it works, and I was able to
further modify it to be a general-purpose position-based substring function,
which is inefficient but works as long as the string is all digits.
Fortunately(?) for me, after spending half the day banging away on it, it
was decided to just change the source data so I don't have to deal with
splitting up 10-digit numbers at all. Heh.

Anyone who is interested can find get_digit_substring.xsl
at http://www.hyperreal.org/~mike/pub/xsl/

-Mike


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



Current Thread