RE: [xsl] managing parameters to stylesheets

Subject: RE: [xsl] managing parameters to stylesheets
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sun, 21 Mar 2004 16:21:45 -0000
This is the problem that "tunnel parameters" in XSLT 2.0 were designed to
solve.

Michael Kay 

# -----Original Message-----
# From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
# [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Dan Vint
# Sent: 20 March 2004 02:39
# To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# Subject: [xsl] managing parameters to stylesheets
# 
# I've been using a setup of stylesheets that take command line 
# parameters (using Saxon) to process a single file into HTML 
# format that is then compiled into MS Help. I used 2 or 3 
# global parameters to manage things like the where to write 
# the file, how to format, etc.
# 
# This process has been working fine because I have had a 
# single document that I want to process. Now I need to process 
# a group of documents into the help format. These documents 
# have sections that should cross-reference each, so processing 
# individually is not an option I want to look at.
# 
# My problem is that each document may have a slightly 
# different combination of control parameters. I've started 
# converting my process over to use a configuration file that 
# lists the objects to process and their individual parameters.
# 
# In making this conversion I've noticed a major programming 
# change. Where I could just rely upon the parameters being 
# available in the old model, I now have to pass these 
# parameters between templates directly. The problem is that I 
# don't have a template for every level in my document. What 
# happens is if I do not explicitly pass a parameter through a 
# template (called in document order, not by name or anything 
# else) then that template doesn't have access to the parameters value.
# 
# What I would at least like to do is convert all my 
# <xsl:apply-templates/> to something like this:
# 
# <xsl:apply-templates>
# 	<xsl:with-param name="dir" select="$dir"/> 
# </xsl:apply-templates>
# 
# If I have a structure like:
# 	Body
# 		Sect
# 			Div
# 				head
# 			Listing
# 				head
# 
# I used to get away with not having to have explicit templates 
# for Div and Listing to have a template for head work just fine.
# 
# Any ideas on how to re-arrange things so I don't have to add 
# all these "default like" templates?
# 
# I would really like the apply-templates to create its own 
# default template setup where not only do modes get 
# automatically added, how about picking up the set of 
# parameters as well?
# 
# Barring that from working, it would be nice to somehow use 
# the <xsl:include> somewhere other than the top of a stylesheet and use
# document() to specify the include as well as the parameters 
# that should be used for that particular document.
# 
# Anyone got another idea for how to tackle this? My current 
# design is going to be very buggy, depending upon how stable 
# the DTD remains in the future.
# 
# ..dan
# --------------------------------------------------------------
# -------------
# Danny Vint
# http://www.dvint.com
# 
# 
#      
# 
# 
#  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
# 
# 

Current Thread