Re: url params et al

Ulrich,

What you are saying is true: in a given case, if you know what
parameters of the expression change, you can write an equivalent XPath
epxressions that takes into account those parameters. In your example,
you know that you want to bind to an element and that the only thing
you want to control is the element name.

My point was that in the general case, if you allow under <myexpr>
*any* XPath 1.0 expression that points to a node, you cannot do that:
you need the ability to evaluate that XPath expression dynamically.

-Erik

Ulrich Nicolas Lissé wrote:
 >
 > Erik,
 >
 > thanks for your answer, but I still don't see any evidence. Given that
 >
 >     <myexpr>first-name</myexpr>
 >
 > both
 >
 >     ref="{/myexpr}"
 >
 > and
 >
 >     ref="*[name()=/myexpr]"
 >
 > will evaluate to the same like
 >
 >     ref="first-name"
 >
 > or
 >
 >     ref="*[name()='first-name']"
 >
 > Regards,
 > Uli.
 >
 > Erik Bruchez wrote:
 >>
 >> Ulrich,
 >>
 >>> while I go with most of what you say, I don't see any use case for
 >>> AVTs within @ref, @nodeset or MIP attributes. These are XPath
 >>> expressions by nature, so anything expressible with AVTs is
 >>> expressible without them, e.g. ref="{/myexpr}" can be written as
 >>> ref="*[name()=/myexpr]".
 >>>
 >>> Is it just to late for me and I'm missing sth obvious ?
 >>
 >> Your example above is incorrect. What this does:
 >>
 >>   ref="{/myexpr}"
 >>
 >> is tell the @ref attribute that its actual value must be evaluated by
 >> first executing the content of the brackets as an XPath expression.
 >> The result of that expression is then used itself as an XPath binding
 >> expression (because that's the semantic of @ref). Say you have:
 >>
 >>   <myexpr>first-name</myexpr>
 >>
 >> This turns @ref into:
 >>
 >>   ref="first-name"
 >>
 >> If on the other hand I have:
 >>
 >>   <myexpr>instance('my-instance')/last-name</myexpr>
 >>
 >> Then @ref turns into:
 >>
 >>   ref="instance('my-instance')/last-name"
 >>
 >> And you can of course have more complex uses of AVTs, like:
 >>
 >>   ref="instance('{instance('dynamic')/instance-name}')/{other-stuff}"
 >>
 >> The point is that with AVTs, what you are actually doing is telling
 >> the XForms processor to evaluate XPath expressions that have been
 >> built at runtime after the XForms engine initialization. So you need
 >> the capability to execute such expressions. Standard XForms can't do
 >> it at all. Standard XSLT can't do it except with AVTs, or with the
 >> evaluate() extension function that every XSLT processor provides.
 >>
 >> As far as I know you can't write an equivalent XPath expression as you
 >> suggest: you either need AVTs or an evaluate() function.
 >>
 >> This said my feeling is that are not many use cases for AVTs in @ref,
 >> and I personally wouldn't push too much for this at the moment.
 >>
 >> -Erik
 >>
 >
 >


-- 
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/

Received on Monday, 28 August 2006 23:33:50 UTC