Search Facility For XML File

AwanJohnie

Usenet Archive
Joined
Sep 21, 2004
Messages
5
Reaction score
0
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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top