By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,494 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,494 IT Pros & Developers. It's quick & easy.

Search Facility For XML File

P: n/a
I want to display results of a search in XML on a browser.
I have created a search form using HTML to accept parameters for the
field "author".
I want to be able to accept this parameter in the xsl and diplay all
results for this. Thanks for your help.

Please see sample XML

?xml version="1.0" encoding="ISO-8859-1" ?>
<live>
<llnode author="Lion" name="STEM" publisher="Dog" >

<llnode author="Cat" name="CANE" publisher="Hen" />

<llnode author="Dog" name="BRANCH" publisher="Ram" />

<llnode author="Cat" name="LEAF" publisher="Dog" />

<llnode author="Dog" name="PIPE" publisher="Dog" />

<llnode author="Lion" name="PANE" publisher="Hen" />

</llnode>
</live>

And a stylesheet to display in tabular form:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="live" />
</body>
</html>
</xsl:template>

<xsl:template match="live">
<table border="1" cellpadding="2" style="border-collapse:
collapse">
<tr bgcolor="#eeeeee">
<th><font face="Tahoma" size="1">AUTHOR</font></th>
<th><font face="Tahoma" size="1">TITLE</font></th>
<th><font face="Tahoma" size="1">PUBLISHER</font></th>

</tr>
<xsl:for-each select="llnode">
<xsl:apply-templates select="llnode" />
</xsl:for-each>

</table>
</xsl:template>

<xsl:template match="llnode">
<tr>
<td><font face="Tahoma" size="2"><xsl:value-of
select="@author"/></font></td>
<td><font face="Tahoma" size="2"><xsl:value-of
select="@name"/></font></td>
<td><font face="Tahoma" size="2">
<A>
<xsl:attribute name="HREF"> http://www.someurlink.com </xsl:attribute>
<xsl:value-of select="@publisher"/>
</A>
</font></td>
</tr>
</xsl:template>
</xsl:stylesheet>
Jul 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.