[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Passing a variable number of parameters to a named-tem

Subject: Passing a variable number of parameters to a named-template
From: Chris Gow <cgow@xxxxxxxxxxxxxxxxxx>
Date: Thu, 18 Jan 2001 19:20:02 -0500
variable number template parameters
What I would like to do is duplicate what programming languages have: pass a number of parameters (or some similar mechanism) to a template without knowing how many parameters were actually passed. For example, JavaScript has the arguments array and Java allows you to pass an array of objects. Can I implement something similar in XSL? I did a search in the archives and didn't find anything along the same lines as what I am looking for (which is surprising, I think).

What kind of want is:

<!-- create the 'array' -->
<xsl:variable name="parameter">
   <sometag>value</sometag>
   <sometag>value1</sometag>
   <sometag>value2</sometag>

<sometag>value3</sometag>
   <sometag>value4</sometag>

<sometag>value5</sometag>
</xsl:variable>

<xsl:call-template name="VariableNumberOfValues">
<!--pass the 'array' -->
<xsl:with-param name="param"><xsl:value-of select="$parameter"/></xsl:with-param>
</xsl:call-template>



<xsl:template name="VariableNumberOfValues"> <!-- iterate over the 'array' --> <xsl:param name="param"/> <xsl:for-each select ="$param/*"> <!--process each element in param --> </xsl:for-each> </xsl:template>


Or something along the lines above?



Thanks



Chris




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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.