I cannot seem to use the value of "." or self::node() as it were.
I want to do the simple update value when the drop-down changes, using the value in the select in an xpath statement to another instance. I hope I can demonstrate without all the code, but happy to submit it. <xforms:group ref="instance('sensor-change')"> <xforms:select1 ref="station" id="station" appearance="minimal"> <xforms:item> ...... </xforms:item> <!-- what's wrong with this? --> <xforms:setvalue ref="../lat" value="instance('sites')/site[sta=.]/lat" /> </xforms:select1> <xforms:input ref="lat" id="lat" /> </xforms:group> it did not work, but specify the entire xpath and voilà : <xforms:setvalue ref="../lat" value="instance('sites')/site[sta=instance('sensor-change')/station]/lat" /> What is happening here? is the ref "lost" when an instance is declared? Thank you. RTFM would be a welcomed response, just tell me which M. --Hank Hank Ratzesberger Institute for Crustal Studies University of California, Santa Barbara 805.893.8042 805.893.8649 (fax) -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
On Wed, Jan 24, 2007 at 04:12:31PM -0800, Hank Ratzesberger wrote:
> <xforms:group ref="instance('sensor-change')"> This sets the default instance for all controls in the group. > <!-- what's wrong with this? --> > <xforms:setvalue ref="../lat" value="instance('sites')/site[sta=.]/lat" > /> Looks for instance('sensor-change')/../lat, which doesn't exist and so is empty. Side note: I'd really like to see errors when you pick something that doesn't exist. Is there a switch? > <xforms:setvalue ref="../lat" > value="instance('sites')/site[sta=instance('sensor-change')/station]/lat" /> Now you're looking in the right instance. -- -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Hank Ratzesberger
Hank Ratzesberger wrote:
Hi > <xforms:setvalue ref="../lat" > value="instance('sites')/site[sta=.]/lat" /> > </xforms:select1> In XPath, the context item (the current node) in a predicate is the node whose the predicate is a predicate of. So in "site[sta=.]", the "." refers to "site". More generaly, the context item changes in several places in the XPath expression. What you want is the context item as it is at the beginning of the expression. This is dependent of the host language (here XHTML). XSLT for example provides the current() function. I think XHTML 1.1 provides this same current() function, but XHTML 1.0 doesn't. Finally, I thought Orbeon Forms supported this function, but http://www.orbeon.com/ops/doc/home-changes-35#d33e416 seems to say it doesn't. Orbeon guys will have to confirm for the Orbeon Forms part. Regards, --drkm ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Mike Leary
On Wed, Jan 24, 2007 at 04:22:28PM -0800, Mike Leary wrote:
> value="instance('sites')/site[sta=.]/lat" > value="instance('sites')/site[sta=instance('sensor-change')/station]/lat" /> Oops, I answered an unasked question. :) This *might* work unless instance is heavy-footed: > value="instance('sites')/site[sta=station]/lat" /> I think the "../lat"s could just be "lat", as in the <input>, since you're starting at the root node. -- -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by Mike Leary
Mike Leary wrote:
> On Wed, Jan 24, 2007 at 04:12:31PM -0800, Hank Ratzesberger wrote: >> <xforms:group ref="instance('sensor-change')"> > > This sets the default instance for all controls in the group. > >> <!-- what's wrong with this? --> >> <xforms:setvalue ref="../lat" value="instance('sites')/site[sta=.]/lat" >> /> > > Looks for instance('sensor-change')/../lat, which doesn't exist and so > is empty. > > Side note: I'd really like to see errors when you pick something that > doesn't exist. Is there a switch? perfectly legal to have bindings to non-existent nodes. But granted it would be very useful. -Erik -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Mike Leary
Thanks for everyone's insights.
It seems verbose, but works: <xforms:setvalue ref="../lat" value="instance('sites')/site[sta=instance('sensor-change')/station]/lat" /> <xforms:setvalue ref="../lon" value="instance('sites')/site[sta=instance('sensor-change')/station]/lon" /> > I think the "../lat"s could just be "lat", as in the <input>, since > you're starting at the root node. What I noticed is that within xforms elements that have a ref= attribute, the axis step changes to the ref, so ../ is necessary. <xforms:group ref="instance('sensor-change')"> <xforms:select1 ref="station"> ... <xforms:setvalue ref="../lat" ...... </xforms:select1> <xforms:input ref="lat" id="lat" /> </xforms:group> --Hank -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
I think you also need an ev:event="xforms-value-changed" on your
setvalue, and probably an action around them if you use two... Leigh. Hank Ratzesberger wrote: > Thanks for everyone's insights. > > It seems verbose, but works: > > <xforms:setvalue ref="../lat" > value="instance('sites')/site[sta=instance('sensor-change')/station]/lat" > /> > <xforms:setvalue ref="../lon" > value="instance('sites')/site[sta=instance('sensor-change')/station]/lon" > /> > >> I think the "../lat"s could just be "lat", as in the <input>, since >> you're starting at the root node. > > What I noticed is that within xforms elements that have a ref= attribute, > the axis step changes to the ref, so ../ is necessary. > <xforms:group ref="instance('sensor-change')"> > <xforms:select1 ref="station"> > ... > <xforms:setvalue ref="../lat" ...... > </xforms:select1> > <xforms:input ref="lat" id="lat" /> > </xforms:group> > > --Hank > > > > ------------------------------------------------------------------------ > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |