Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Xsl Formatting of SSno, Phone no

Status
Not open for further replies.

GKatReliable

Programmer
Jul 2, 2002
45
0
0
US
I have searched for tips on how to format a Social Security Number or a phone number using xls when the xml is such as this:
<ssno>123456789</ssno>
<phone>1234567890</phone>
The SSno should appear on a web page as
123-45-6789
and the phone number should be, of course,
(123) 456-7890
I can't find any specific reference to the xsl syntax for doing this.
Regards,
Glenn Koproske
 
Glenn,

It will be a combination of things. I will do SSN and leave phone number as an exercise for the student (as my old calculus textbook used to say).
Code:
 ...
<xsl:value-of select="substring(ssno,1,3)/><xsl:text>-</xsl:text>
<xsl:value-of select="substring(ssno,4,2)/><xsl:text>-</xsl:text>
<xsl:value-of select="substring(ssno,6,4)/>

Tom Morrison
 
Much appreciated.

One other question, in ASP.Net in Visual Studio.Net 2003 at our company, when you create a new document for Xsl, Microsoft creates an .xslt file for you. All of the MSDN documentation says to save things to an .xsl file.
Are the .xslt and .xsl file extensions interchangeable?

Regards,
Glenn Koproske
 
Yes, I would think so. One would further speculate that the .xsl is a carryover from the days when extensions were limited to three characters. You see the same thing with .htm and .html.

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top