ASP 101 - Active Server Pages 101 - Web05
The Place ASP Developers Go!

Please visit our partners


Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates














ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash





Script Output:
First NameLast NameSales
AndrewFuller5000
JanetLeverling6250
StevenBuchanan3245
MargaretPeacock4685
RobertKing5290
DavidAndersen6420
FrankEdwards3840
KateRichards4260
EdwardJones3450
LauraCallahan3675
GregMiller5640
TammySteel3570

ASP HTML Download            FAQ

ASP.NET Version

By now I'm sure you're probably using XML files for something. Whether it be data transfer, storage, caching, or something else altogether, it's a great technology. Anyway, my point is that you've probably got a few XML files lying around your website. While XML is designed to be human readable as much as it is machine readable, sometimes it's nice to look at something without the <>'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 enhancements

  1. You can do everything in one function call
  2. The more complicated functions call the simpler ones, keeping everything clean
  3. You can pass parameters into your stylesheet straight from the function call

The functions are:

  • GetXslStyleSheet(ByVal strStyleSheetLocation)
  • GetXslStyleSheetWithParams(ByVal strStylesheetLocation, ByVal strParams)
  • GetXmlDocument(ByVal strDocumentLocation)
  • GetXmlDocumentByStyleSheet(ByVal strDocumentLocation, ByVal strStyleSheetLocation)
  • GetXmlDocumentByStyleSheetWithParams(ByVal strDocumentLocation, ByVal strStyleSheetLocation, ByVal strParams)

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.

Thanks
Chris Surfleet

No 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.


Samples

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers