[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: format-number() for a phone number?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|