| First Name | Last Name | Sales |
|---|---|---|
| Andrew | Fuller | 5000 |
| Janet | Leverling | 6250 |
| Steven | Buchanan | 3245 |
| Margaret | Peacock | 4685 |
| Robert | King | 5290 |
| David | Andersen | 6420 |
| Frank | Edwards | 3840 |
| Kate | Richards | 4260 |
| Edward | Jones | 3450 |
| Laura | Callahan | 3675 |
| Greg | Miller | 5640 |
| Tammy | Steel | 3570 |
<>'s. This little script will take an XML file and an XSL file and combine them to produce whatever output you want. The sample files (xmlxsl.xml and xmlxsl.xsl) contain a copy of some of our fake sample data and convert it to a basic HTML table, but you can use the same code to transform your data into whatever you want... just change the stylesheet.
Using Remote XML/XSL Files
If you're going to be pulling either the XML of XSL file from a remote server, you should take a look at the remote version of this sample: XML to HTML (via XSL) - Remote Files.Update: Common Functions for Working with XML and XSL Files
One of our readers read our sample and decided to share a few functions that he's been using to handle his XML and XSL needs. Here's his email:I've just looked at XML to HTML (via XSL) Classic ASP Sample, and I realised that I've written a few (5) functions for doing this, but with a few enhancementsNo Chris... Thank You! I sure many of our users will find the functions extremely helpful. Oh and speaking of the functions, here they are: server-xml.zip (1 KB). Like Chris said, they're pretty simple to figure out and there are basic comments included with the source. Thanks again Chris.
The functions are:
- You can do everything in one function call
- The more complicated functions call the simpler ones, keeping everything clean
- You can pass parameters into your stylesheet straight from the function call
Here is the pure file (complete with pseudo XML comments) - I'll write up a little guide to the code if you like it. It's not doing anything special, but I don't think I've noticed anything quite like it being posted before.
GetXslStyleSheet(ByVal strStyleSheetLocation)GetXslStyleSheetWithParams(ByVal strStylesheetLocation, ByVal strParams)GetXmlDocument(ByVal strDocumentLocation)GetXmlDocumentByStyleSheet(ByVal strDocumentLocation, ByVal strStyleSheetLocation)GetXmlDocumentByStyleSheetWithParams(ByVal strDocumentLocation, ByVal strStyleSheetLocation, ByVal strParams)
Thanks
Chris Surfleet
0 Responses to “XML TO HTML Page Creation”
Post a Comment