Subject: RE: XML/XSL and ASP/IIS
From: Mike Dierken <mike@xxxxxxxxxxxxxxx>
Date: Thu, 3 Jun 1999 07:42:25 -0700
Passing parameters to an XSL stylesheet (or any XML file) is something that
pops up now and then.
The approach that I've taken is to use entity references inside the XML/XSL
file, and extend the 'DOM builder' class to adjust the value of the entities
when the DTD portion of the XML file is parsed, but before the body of the
XML file is parsed.

An example XML file would look like:

<!DOCTYPE layout [
 <!ENTITY baseResourcePath "/layouts/theme1/" >
 <!ENTITY username "Mr. Bigglesworth" >

<xsl:stylesheet xmlns:xsl="";>
  <xsl:template match="/">
    Welcome &username;!<br />
    <img src='&baseResourcePath;welcome.gif' />

Since I use a Java XML processor that supports SAX events, it was pretty
easy to extend the base Document class to accept a list of name/value pairs
(a Hashtable) and adjust the entity values when the 'on DTD Parsed' event

I wrote an article with sample Java code for the DataChannel XML Parser - 
Let me know what you think.

Mike D

 XSL-List info and archive:

Current Thread