Andez

All,

I was wondering if it was possible to populate a dropdown/combo box on an HTML page from the contents of an XML file in a nice kind of way. The idea is to have a web browser control in a form in a .NET project that navigates to a 'file' on a UNC from each client application. From there the user will be able to view nicely formatted data from the log file and be able to apply filtering actions on it.

The purpose of this is to provide the user with 2 combo boxes which act as a filter to the XML data. The data relating to the selection is then to be displayed when the user clicks on a filter/refresh button - i.e - the user selects a date and a town from the dropdown lists and clicks on the filter button and the xml will be filtered based on the selection.

I have a put together code in XSLT to do this which works ok in the fact that it populates the combo boxes. You can run it in explorer and the xml is automatically transformed to xhtml via the xslt.

It does not do any filtering as yet.

-- XML --

Code Snippet

< <xml version="1.0" encoding="utf-8" >

< <xml-stylesheet type="text/xsl" href="mystylesheet.xslt" >

<servicelog>

<logentry dateentered="1-August-2007">

<town name="Leeds">

<person firstname="Dave" lastname="Smith" />

</town>

<town name="Sheffield" />

<person firstname="Peter" lastname="Smith" />

<person firstname="John" lastname="Smith" />

</</town>

</logentry>

</servicelog>

-- XSLT --

<

Code Snippet

xml version="1.0" encoding="utf-8" >

<xsl:stylesheet version="1.0"

<xmlns:xsl=http://www.w3.org/1999/XSL/Transform>

<xsl:output method="html"/>

<xsl:template match="/">

<html>

<head>

</head>

<body>

<br />

Date:

<select id="Select1" style="width: 142px">

<xsl:for-each select="//logentry">

<option>

<xsl:value-of select="@dateentered"/>

<option>

<xsl:for-each>

<select>

<xsl:for-each select="//town">

<table>

<tr>

<td>

<xsl:value-of select="@name"/>

<td>

<tr>

<table>

<br/>

<table>

<tr>

<td>

First Name

<td>

<td>

Last Name

<td>

<tr>

<xsl:for-each select="./person">

<tr>

<td>

<xsl:value-of select="@firstname"/>

</td>

<td>

<xsl:value-of select="@lastname"/>

<td>

<tr>

<xsl:for-each>

<table>

<br/>

<br/>

</xsl:for-each>

</body>

</html>

I'm not too sure if this is a good way of doing things.

I was hoping someone would be able to give me some advice on this or point me at some good examples

Cheers,

Andez