xsl-list
[Top] [All Lists]

Re: [xsl] initial template parameters

2010-03-18 09:13:47
Yes, if we can choose an entry point then why cannot we provide
parameters for it?
I think this restriction makes initial templates less useful, unless
we choose between a set of parameterless templates.

Using globals as defaults isn't really a solution, since that would
restrict the set of templates with parameters to choose from to one,
the one whose parameters are duplicated as global parameters.

The only solution I can think of is using extension methods to pull
the parameters from the environment, something like this:

<xsl:param name="color" value="(ext:get-parameter('color'), 'red')[1]"
as="xs:string"/>

I suspect there isn't enough people concerned about this to get this
issue into the working group's todo list (sigh).
--
Max

2010/3/18 Michael Kay <mike(_at_)saxonica(_dot_)com>:
"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? :-(

Either because we were lazy, or because we wanted to keep things simple, or
both. I think an interface in which you could supply both the values of
stylesheet parameters and the values of parameters to the initial template
might be confusing to many users. However, I can see why you want it:
logically, the requirement makes sense.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--