Previous examples have shown how unformatted XML files can be created from either Excel or Access. These data files can be viewed directly in a browser - but this is not a very user friendly format.
Would you like to learn more?
The following methods are only intended to be examples - very little explanation is offered and so it should be viewed in conjunction with an XML and XSL tutorial such as that offered by W3C schools. I am only illustrating the display of tables of data, not individual records. If you wish to copy the files in order to adapt them for your own purposes, it is easier to use the text files which are not affected by any formatting applied by your browser.
Note that these examples work in IE but not with the Firefox browser.
Would you like to learn more?
An improved XML file can be displayed on a new web page. The original unformatted XML data file is modified and a new second line inserted giving a reference to a XSL stylesheet which causes the data to be displayed in an attractive table. Note that the XSL code adds a page heading, table column titles and applies CSS styles. The CSS is unnecessary if you are happy with standard formats for HTML tags such as <Table> and <H1>. No sorting or selection has been incorporated within this XSL.[View page] [View code]
The XML file can receive instructions from the XSL file for formatting, sorting and criteria. If you want to offer users more than one option for the sorting order you can create a corresponding number of XML data files, each of which has a reference (on the second row) to a different version of the XSL instruction files. If you have large data files (XML) it may not be convenient to save numerous copies, merely to give different formatting, selection or sorting options. [View page] [View code]
An unformatted XML file can be displayed directly within any web page by including the displayed code (below) at the appropriate place in your HTML code. There is no reference to an XSL and therefore no sorting or selection.
<XML id="myauthsigs" src="myxml/xl_xml_data.xml"></XML> <table class="red" datasrc="#myauthsigs"> <thead><tr> <th>Directorate</th> <th>Code</th> <th>Name</th> <th>Value</th> <th>Joined</th> </tr></thead> <tr> <td><div datafld="directorate"></div></td> <td><div datafld="acode"></div></td> <td><div datafld="name"></div></td> <td align="right"><div datafld="value"></div></td> <td><div datafld="start_date"></div></td> </tr> </table>
This is a complicated topic and I have shown a few relatively simple solutions. Programming knowledge will enable you to produce more sophisticated solutions but that is beyond the scope of this site. The examples above will enable you to quickly share up-to-date information on a web page.
|Get this information as a document
accompanied by Excel worksheets
|Click here for details about
obtaining this file
|Page file: xl_xml2.htm||© MeadInKent.co.uk 2011||Page last updated Nov07|