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

contains()???

Subject: contains()???
From: "Gitanjali" <narsu@xxxxxxxxxxxxx>
Date: Tue, 15 May 2001 20:59:23 -0400
1800callme
All,

Could you please solve my problem.  Acutally I passed the parameter from the
html as id = "1002,1003,1004"

Now I want to display only those records where parameter id matches the
input .  The following xsl is not working...It's displaying all the results.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" indent="no" />
  <xsl:param name="id" select="1003" />

  <xsl:template match="addresses">
 <xsl:value-of select="$id"/>
 <xsl:if test="contains(string(emp[@id]),string($id))"> </xsl:if>
     <xsl:apply-templates select="emp"/>
 <xsl:if test="contains(string(emp[@id]),string($id))"> </xsl:if>
  </xsl:template>

  <xsl:template match="emp">
    <h1>Name: <xsl:value-of select="concat(details/@fname, ' ',
details/@lname)" /></h1>
    <p>Email: <a href="mailto:{email}";><xsl:value-of select="email"
/></a><br />
    Country: <xsl:value-of select="details/@country" /><br />
 Phone: <xsl:value-of select="details/@phone" />
    </p>
  </xsl:template>
</xsl:stylesheet>


My xml file is :

<addresses>
 <emp registered="20010125" id="1001">
  <email>scott@xxxxxxxxxx</email>
  <details fname="Scott" lname="Wilson" country="UK" phone="1800callme"/>
 </emp>
 <emp registered="20010125" id="1002">
  <email>john@xxxxxxxx</email>
  <details fname="John" lname="Kerr" country="USA" phone="1800callJohn"/>
 </emp>
 <emp registered="20010125" id="1003">
  <email>kim@xxxxxxxxx</email>
  <details fname="Kimberly" lname="Chung" country="USA"
phone="1800callKim"/>
 </emp>
 <emp registered="20010125" id="1004">
  <email>Tim@xxxxxxxxxx</email>
  <details fname="Timmothy" lname="Kelley" country="USA"
phone="1800callTim"/>
 </emp>
 <emp registered="20010125" id="1005">
  <email>Marie@xxxxxxxxxxxx</email>
  <details fname="Marie" lname="Whitaker" country="AU"
phone="1800callMarie"/>
 </emp>
</addresses>



Thanks
Narsu


 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.