Re: Parameter binding

/ ht@inf.ed.ac.uk (Henry S. Thompson) was heard to say:
| I believe the consequence of this is that either of the following are
| correct:
|
|  <my:xmpl>
|   <p:import-parameter name="my:parm"/>
|  </my:xmpl>
|
|  <my:xmpl>
|   <p:parameter name="my:parm" select="$my:parm"/>
|  </my:xmpl>
|
| But I have to say the second is dodgy -- it's not clear what
| environment is appealed to for the evaluation of the variable
| reference, and the prose in 5.7.3 suggests it's actually not allowed.
|
| I think this should be allowed, partly because at least some
| programming languages allow this -- consider LISP, where
|
|  (lambda (x)
|    (let (x (+ x x))
|      (* x x)))
|
| computes, somewhat obscurely, (2x)^2, and Python, where
|
|   x=3
|
|   def f(x=x+x):
|     return x*x
|
|   print f()
|
| will print 36, but more importantly because the environment which the
| p:import-parameter should use clearly does _not_ create a loop, and
| the XPath should be seeing the same environment.

I agree.

| In other words, and perhaps we should say this explicitly, the
| in-scope parameters of the environment are _only_ available in two
| ways:
|
|  1) via XPath variable references;
|  2) via p:import-parameter.
|
| I guess I think every place we allow an XPath we should say which
| environment it is whose in-scope parameters provide the variable
| binding static context, and likewise whereever p:import-parameter is
| allowed we should say which environment it is whose in-scope
| parameters are available for import.  When we have both, as for
| e.g. vanilla steps, that environment should be the same in both cases.

Yes.

| [Final quibble -- I find 5.7.2 quite confusing -- the bit in
| pink/purple is not actually a valid parameter use -- I think the prose
| of 5.7.2 and 5.7.3 should be collapsed, and the first pink/purple box
| eliminated.]

It's perfectly valid in a declare-step; but I agree that 5.7.2 is a
strong candidate for a rewrite.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.

Received on Wednesday, 4 April 2007 22:26:47 UTC