[xsl] Passing variable number of parameters to xsl file

Subject: [xsl] Passing variable number of parameters to xsl file
From: Kim <kimba_40@xxxxxxxxx>
Date: Wed, 20 Mar 2002 23:51:48 -0800 (PST)
Hi, I need to be able to support a variable number of parameters.  I am
currently using Xalan v2.2.

For example, the user would invoke Xalan with parameters:
  
	-PARAM paramName1 paramValue1 -PARAM paramName2 paramValue2  ...
-PARAM paramNameN paramValueN
	(specific example: -PARAM autobrand1 ford -PARAM autobrand2 lexus
-PARAM tire1 goodyear -PARAM tire2 michellan)

where N could be for example 1...500.

Couple of Questions:

1) Is there a way to get the param count other than having it passed in
as something like: -PARAM numParams 500?
2) What I need to do is test a node's value against all of the
parameter values passed in.  Note that for each invocation N could be:
0, 1, 2, ..500.

I want to do something like:

	if (nodeValue match any of the paramValues of passed in)
	then
  		doSomething();
	endif

for each parameter "family" (ex. autobrand and tire mentioned above)

without being forced to have a set of fixed static hardcoded test
statements in the xsl like:

	if (nodeValue match $paramName1)
		doSomething()
	else if  (nodeValue match $paramName2)
		doSomething()
		...
	else if (nodeValue match $paramNameN)
		doSomething()
	endif

where doSomething() is the exact same function for all
nodeValue/paramValue matches.

I have some ideas concerning using key, <xsl:choose>, <xsl:when>,
temporary tree, <or> features, but am not sure which path is best to
proceed on.

Thank you,



=====
Kim

*************************
May the force be with you.
*************************

__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

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


Current Thread