This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
contains()???
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@wilson.com</email>
<details fname="Scott" lname="Wilson" country="UK" phone="1800callme"/>
</emp>
<emp registered="20010125" id="1002">
<email>john@kerr.com</email>
<details fname="John" lname="Kerr" country="USA" phone="1800callJohn"/>
</emp>
<emp registered="20010125" id="1003">
<email>kim@chung.com</email>
<details fname="Kimberly" lname="Chung" country="USA"
phone="1800callKim"/>
</emp>
<emp registered="20010125" id="1004">
<email>Tim@kelley.com</email>
<details fname="Timmothy" lname="Kelley" country="USA"
phone="1800callTim"/>
</emp>
<emp registered="20010125" id="1005">
<email>Marie@Whitaker.com</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