Re: Option or parameter?

/ Jeni Tennison <jeni@jenitennison.com> was heard to say:
| Let me take another tack. Take as a starting point an XSLT 2.0 step:
|
| <p:xslt2>
|   <p:input port="stylesheet">
|     <p:document href="foo2html.xsl" />
|   </p:input>
|   <p:option name="initial-mode" select="$view" />
|   <p:import-parameter name="*" />
| </p:xslt2>
|
| Let's say that we want to provide an easier interface to calling the
| foo2html.xsl stylesheet, and wrap it in a pipeline. Currently, this
| has to be:
|
| <p:pipeline name="my:foo2html">
|   <p:input port="source" />
|   <p:output port="result" />
|   <p:parameter name="initial-mode" required="yes" />
|   <p:parameter name="*" />
|   <p:xslt2>
|     <p:input port="stylesheet">
|       <p:document href="foo2html.xsl" />
|     </p:input>
|     <p:option name="initial-mode" value="$initial-mode" />
|     <p:import-parameter name="*" />
|   </p:xslt2>
| </p:pipeline>
|
| and I replace my original <p:xslt2> with:
|
| <my:foo2html>
|   <p:parameter name="initial-mode" select="$view" />
|   <p:import-parameter name="*" />
| </my:foo2html>
|
| I had to make three changes here: change the name of the step (as
| expected), remove the <p:input> (as expected), and change the
| <p:option> to <p:parameter> (as completely unexpected).

And with your proposal it would have been this, right?

<p:pipeline name="my:foo2html">
  <p:input port="source" />
  <p:output port="result" />
  <p:option name="initial-mode" required="yes" />
  <p:xslt2>
    <p:input port="stylesheet">
      <p:document href="foo2html.xsl" />
    </p:input>
    <p:option name="initial-mode" value="$initial-mode" />
    <p:import-parameter name="*" />
  </p:xslt2>
</p:pipeline>

and I replace my original <p:xslt2> with:

<my:foo2html>
  <p:option name="initial-mode" select="$view" />
  <p:import-parameter name="*" />
</my:foo2html>

(And actually, I think the import-parameter is either unnecessary or
not allowed but let's come back to that another time.)

| By comparison, if <p:parameter> is reserved for passing parameters
| into stylesheets (and other components that require arbitrary
| name/value pairs) then I only have to make the expected changes in the
| call in the original pipeline, and I don't end up with naming clashes.

The downside becomes that you can't compute the values of either
options or parameters from the values of other parameters.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | My problems start when the smarter
http://nwalsh.com/            | bears and the dumber visitors
                              | intersect.--Steve Thompson, wildlife
                              | biologist at Yosemite National Park

Received on Wednesday, 25 April 2007 16:06:59 UTC