Re: [xsl] include css in xsl

Subject: Re: [xsl] include css in xsl
From: Steve Rosenberry <Steve.Rosenberry@xxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Mar 2003 13:15:03 -0500
TP wrote:
> 
> Then I tried by replacing ../css/style.css with the absolute path and it
> worked. But obviously, writing the absolute path in the stylesheet would be
> murder in transferring this on say linux for example.
> 

Been there, done that!  Excellent opportunity to use one or more
variables for various path names (e.g. css path, cgi-bin path, image
path).  Depending upon how many you have and where they're used, these
can be placed in a separate XSLT path configuration file to be included
in the functional XSLT files.  Keep a configuration file locally for
offline development and another online for the server environment.  When
you change environments, you change the paths in a single file only.  

Bottom line rule: No paths, absolute or relative, hard-coded in the
XSLT.  (This is XSLT version of the C/C++ rule, use #define constants
instead of actual numbers.)

If you go this way, other little things you may find useful:

1) A batch file to rebuild all the HTML pages for when the path
configuration file changes -- and it will.

2) An XSLT named template to create complete path names from base
names.  In my application, the base name was in different XML elements,
and based upon the element, I would select the appropiate path name to
combine with the base name for a complete path.

-- 
Steve Rosenberry
Sr. Partner

Electronic Solutions Company -- For the Home of Integration
http://ElectronicSolutionsCo.com

(610) 670-1710

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread