Sample Application: XML Form Generator, Part 3: Displaying the Results
page 1 of 1
Published: 14 Oct 2004
Unedited - Community Contributed
Abstract
Part 1 of this series demonstrated how to create an XML form using a DataGrid in a web page. Part 2 focused on how to display the XML form using XSL and then save the user input to a new XML file. This final part of the series will show how to create a web form that will list the saved XML results and allow viewing the data.
by Andrew Mooney
Feedback
Average Rating: 
Views (Total / Last 10 Days): 11782/ 17

[ Download Code ] | [ Run Sample ]

Part 1 of this series demonstrated how to create an XML form using a DataGrid in a web page. Part 2 focused on how to display the XML form using XSL and then save the user input to a new XML file. This final part of the series will show how to create a web form that will list the saved XML results and allow viewing the data.

The view.aspx web form creates a list of all XML files in the "results" sub-directory. This is a list of all the user input that was saved when the forms were submitted. The page simply displays a list of file names, minus the extension (.xml), with a link to the results.aspx web form. Example: results.aspx?results=file-name. Controlling the extension (.xml) this way makes sure that only XML files are in the list.

The results.aspx web form gets the file name from the query string, adds the extension (.xml) and the path to the "results" sub-directory. The XML file is then loaded and transformed using the results.xsl file.

The results.xsl file is a generic XSL that will transform any XML file. So, no matter how many fields you have in your XML form they will all be displayed in the results page. I also added a slight touch of color to the XSL to make the results look better.

Now, we have a fully working application that generates XML forms, captures user input to an XML file, and displays the results. The download includes all the web forms, the XSL files, the sample XML forms, and some sample result XML files from all three parts of this article. To install, just unzip it to a virtual directory.

The following is a list of the included files:

  • XmlFormGen.aspx - Used to generate XML forms.
  • Default.aspx - Used to display XML forms and save user input when the form is submitted.
  • View.aspx - Displays a list of all XML files in the "results" sub-directory.
  • Results.aspx - Displays the data in a single XML result file.
  • Form.xsl - Transforms the XML forms into ASP.NET controls.
  • Results.xsl - Generic XSL form displaying an XML results file.
  • Test.xml and Sample.xml – These are sample XML forms.
  • 1aa91e9c-1aeb-4854-94a3-308dbb165fee.xml and 7e73845c-bc4f-4c65-8eb8-f90ad053e684.xml – These are sample result XML files.


User Comments

No comments posted yet.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-18 11:29:28 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search