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

RE: Formatting Question

Subject: RE: Formatting Question
From: "Charles Knell" <cknell@xxxxxxxxxx>
Date: Thu, 08 Aug 2002 10:06:10 -0700
xsl zip 4 formatting
First: US ZIP codes are either five digits or nine digits. Six digits
will get you nowhere.

Second: Is it the case that some of your ZIP codes are five digits long
while others are nine digits long? If this is the case, and your ZIP
code is represented so -- <zip>55555</zip> or <zip>999999999</zip> --
then you will want a ZIP code template like this:

<xsl:template match="zip">
  <xsl:choose>
    <xsl:when test="string-length(.) = 5">
      <xsl:value-of select="." />
    </xsl:when>
    <xsl:when test="string-length(.) = 9">
      <xsl:value-of select="substring(.,1,5)-substring(.,6,4)" />
    </xsl:when>
    <xsl:otherwise>
      <!-- what will you do if the number is neither length -->
    <xsl:otherwise>
  <xsl:choose>
</xsl:template>

-- 
Charles Knell
cknell@xxxxxxxxxx - email


---- "Tengshe, Ashish" <Tengshe.Ashish@xxxxxxxxxxxxx> wrote:
> I think you mean 507070 or 507070---
> right? Then
> 
> <xsl:variable name="dashes" select="'---------'" />
> <xsl:value-of select="substring(concat(six_digit_zip, $dashes), 1,
> 9)" />
> 
> This should do it! (Note: This should solve your 9 digit problem, for
> keeping the six digits, you should have a 
> normal <xsl:value-of select="six_digit_zip"/>
> 
> Thanks,
> Ash
> 
> -----Original Message-----
> From: Jitt_Joynoosaeng@xxxxxxxxxxx [mailto:Jitt_Joynoosaeng@xxxxxxxxxxx]
> Sent: Thursday, August 08, 2002 11:09 AM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Formatting Question
> 
> 
> Hello everyone,
> 
> I have a zip code tag that is stored in the regular 6 digit format
> and 
> also with 9 digits.  For the 9 digits, I wanted to add a dash after
> the 
> 6th digit.  Is this possible to do?  If it is, can someone show me
> how 
> it can be done?
> 
> Thank you!
> 
> Jitt
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  

 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.