Hi all,
Can someone explain why the position() function return a different value in a repeat group ? I want to bind an itemset of a select1 control that is outside the current instance. But it seems that the position() function always return 1. See the attached example.(See the different return value of position()) -- Marc -- 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 |
Erik, The code you're provided doesn't work. The position() Xpath 2.0 function does not return the same result in a repeat loop inside or outside a select1 control. See my new attached example.(the label of the select1) Marc >This is due to the way XPath works. In this expression: >instance('listes-simple')/liste[@id=instance('instance')/choix[position >()]/@value]/item >a new context is created once you use "[...]", so position applies to the position within that context, which is by default 1. >Maybe you can try something like this (XPath 2.0): >for $position in position() return >instance('listes-simple')/liste[@id=instance('instance')/choix[$positio >n]/@value]/item -Erik -- 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 liste.xhtml (3K) Download Attachment |
Administrator
|
Marc,
Then try something like: instance('listes-simple')/liste[@id=instance('instance')/choix[count(xxforms:repeat-current('idxChoix')/preceding-sibling::*) + 1]/@value]/item This will be easier to express once we have XSLT-like variables in XForms. -Erik marc wrote: > > Erik, > > The code you're provided doesn't work. > The position() Xpath 2.0 function does not return the same result in a > repeat loop inside or outside a select1 control. > See my new attached example.(the label of the select1) > > Marc > > >This is due to the way XPath works. In this expression: > > >instance('listes-simple')/liste[@id=instance('instance')/choix[position > >()]/@value]/item > > >a new context is created once you use "[...]", so position applies to > the position within that context, which is by default 1. > > >Maybe you can try something like this (XPath 2.0): > > >for $position in position() return > >instance('listes-simple')/liste[@id=instance('instance')/choix[$positio > >n]/@value]/item > > -Erik Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- 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 |
Thanks Erik,
XSLT-like variables in XForms ? Cool !!!! -- Marc Erik Bruchez a écrit : > Marc, > > Then try something like: > > instance('listes-simple')/liste[@id=instance('instance')/choix[count(xxforms:repeat-current('idxChoix')/preceding-sibling::*) > + 1]/@value]/item > > This will be easier to express once we have XSLT-like variables in > XForms. > > -Erik > > marc wrote: > >> >> Erik, >> >> The code you're provided doesn't work. >> The position() Xpath 2.0 function does not return the same result in >> a repeat loop inside or outside a select1 control. >> See my new attached example.(the label of the select1) >> >> Marc >> >> >This is due to the way XPath works. In this expression: >> >> >instance('listes-simple')/liste[@id=instance('instance')/choix[position >> >> >()]/@value]/item >> >> >a new context is created once you use "[...]", so position applies >> to the position within that context, which is by default 1. >> >> >Maybe you can try something like this (XPath 2.0): >> >> >for $position in position() return >> >instance('listes-simple')/liste[@id=instance('instance')/choix[$positio >> >> >n]/@value]/item >> >> -Erik > -- 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
|
> XSLT-like variables in XForms ? Cool !!!!
Yes, I think this is sorely needed. David Landwehr has already proposed something like this on exforms.org: http://exforms.org/variable.html I think that we will implement this in the fairly short-term future. -Erik -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- 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 |