[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: initial template parameters
At 2010-03-18 01:29 -0400, Max Toro wrote:
"Parameters passed to the transformation by the client application are matched against stylesheet parameters (see 9.5 Global Variables and Parameters), not against the template parameters declared within the initial template. All template parameters within the initial template to be executed will take their default values." Why not? It is quite flexible that way. If you want to have parameters passed to the transformation to be accessed from within the initial template to be executed, then have the default values of the initial template use the global values: <xsl:param name="global-command-line"/> <xsl:template match="/"> <xsl:param name="initial" select="$global-command-line"/> ...$initial... </xsl:template> Because local variables shadow global variables you could have the following if you plan to invoke the initial template a number of times in the transform: <xsl:param name="x"/> <xsl:template match="/"> <xsl:param name="x" select="$x"/> ...$x... </xsl:template> Since global variables are visible to all templates, if you are only ever invoking the initial template once, then you don't need the parameter in the template because the global parameter is visible: <xsl:param name="x"/> <xsl:template match="/"> ...$x... </xsl:template> I think this flexibility is quite important. In my XSLStyle documentation methodology for XSLT stylesheets I have a template rule for the root node that has parameters initialized when first invoked from the command line but passed with new values when the same template rule is invoked later in the transformation. Can you express what concerns you about not having them passed? I hope this helps. . . . . . . . . . . Ken
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|