Subject: [xsl] contains()??? From: "Gitanjali" <narsu@xxxxxxxxxxxxx> Date: Tue, 15 May 2001 20:59:23 -0400 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XPath for number of prece, Michael Strasser | Thread | RE: [xsl] XPath for number of prece, Michael Kay |
Re: [xsl] XPath for number of prece, Michael Strasser | Date | RE: [xsl] contains()???, Diamond, Jason |
Month |