Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optional parameters when calling an XSL template

Tags:

People also ask

How do I pass multiple parameters in XSLT?

Answer. In order to pass multiple parameters to XSLT from BP you'll need to pass '=' as a separator.

How do you use parameters in XSLT?

To use an XSLT parameterCreate an XsltArgumentList object and add the parameter using the AddParam method. Call the parameter from the style sheet. Pass the XsltArgumentList object to the Transform method.


Is there way to call an XSL template with optional parameters?

For example:

<xsl:call-template name="test">   <xsl:with-param name="foo" select="'fooValue'" />   <xsl:with-param name="bar" select="'barValue'" /> </xsl:call-template> 

And the resulting template definition:

<xsl:template name="foo">   <xsl:param name="foo" select="$foo" />   <xsl:param name="bar" select="$bar" />   <xsl:param name="baz" select="$baz" />   ...possibly more params... </xsl:template> 

This code will gives me an error "Expression error: variable 'baz' not found." Is it possible to leave out the "baz" declaration?

Thank you, Henry