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

Starts-with not working with numbers

Subject: Starts-with not working with numbers
From: "Grant, Kathryn --- Sr. Technical Writer --- WGO" <Kathryn.Grant@xxxxxxxxxxxxxxxxx>
Date: Tue, 9 Mar 2004 17:15:35 -0800
xsl starts with
Hello,

I have an XML file of city, state and ZIP codes, and an HTML form where the user can input a full or partial ZIP code (param1). I'm trying to use <choose> to return a list of matching ZIP codes.

The first "when" section checks to see if any ZIP_CD is an exact match for param1. It works fine.

The second "when" section is supposed to check to see if any ZIP_CD *starts with* param1. BUT I can't get it to work. Instead, it returns a list of all ZIP codes in the file. I wondered if this was because they were numbers, so I tried converting them with string(), which didn't work, and then number() (getting desperate) which also didn't work. I even tried translate(), translating the numbers to letters, but that also didn't work.

The "otherwise" section also fine--if I input a non-existent ZIP code, I get the "no matches found" message.

How can I get the second "when" to pull a list of ZIP codes that start with param1?

Thanks in advance!

Kathryn

<xsl:choose>
<xsl:when test="//POINT_RECORDS/POINT_REC/ZIP_CD=$param1">

<TABLE border="0" width="90%" style="font-size: 10pt" cellspacing="1" cellpadding="1">
<tr>
<th><b>City</b></th>
<th><b>State</b></th>
</tr>

<xsl:for-each select="//POINT_RECORDS/POINT_REC[ZIP_CD=$param1]">
<xsl:sort select="CITY_NM"/>

<tr>
  <td style="font-size:8pt" valign="top">
     <xsl:value-of select="CITY_NM"/>
  </td>

  <td style="font-size:8pt" valign="top">
    <xsl:value-of select="STATE_CD"/>
  </td>
</tr>

</xsl:for-each>

</TABLE>    

</xsl:when>

***** THIS PART DOES NOT WORK*********

<xsl:when test="//POINT_RECORDS/POINT_REC[starts-with(ZIP_CD, $param1)]">

<TABLE border="0" width="90%" style="font-size: 10pt" cellspacing="1" cellpadding="1">

<tr>
<th><b>City</b></th>
<th><b>State</b></th>
<th><b>State</b></th>

</tr>

<xsl:for-each select="//POINT_RECORDS/POINT_REC">
<xsl:sort select="ZIP_CD"/>


<tr>
  <td style="font-size:8pt" valign="top">
     <xsl:value-of select="CITY_NM"/>
  </td>

  <td style="font-size:8pt" valign="top">
    <xsl:value-of select="STATE_CD"/>
  </td>

  <td style="font-size:8pt" valign="top">
    <xsl:value-of select="ZIP_CD"/>
  </td>

</tr>

</xsl:for-each>

</TABLE>    

</xsl:when>

<xsl:otherwise>
<p align="center">(No matches found)</p>
</xsl:otherwise>
</xsl:choose>


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


 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.