All,
I've been trying to retrieve the index of the current repeat, but am having some difficulties. I have attached the source code to demonstrate the problem. These are the recomendations I were following: http://mail-archive.objectweb.org/ops-users/2006-09/msg00197.html Here is my view: ============ <xhtml:head> <xhtml:meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <xhtml:title>Testing</xhtml:title> <xforms:model> <xforms:instance id="test"> <aspic:inputs> <aspic:input>a</aspic:input> <aspic:input>b</aspic:input> </aspic:inputs> </xforms:instance> </xforms:model> </xhtml:head> <xhtml:body> <xforms:repeat nodeset="instance('test')/aspic:input" id="test-repeat"> <xforms:input ref="."> <xforms:label> Index: <xforms:output value="index('test-repeat')"/>, Position: <xforms:output value="position()"/> </xforms:label> </xforms:input> <xhtml:br/> </xforms:repeat> </xhtml:body> </xhtml:html> The outcome from this is: =========================== Index: 1, Position: 1 Index: 1, Position: 1 The EXPECTED outcome from this is: =========================== Index: 1, Position: 1 Index: 1, Position: 2 Is this expected behaviour or a bug? If this is expected behaviour, how would you retrieve the current index from within a label in an xforms control? Anyone else had this problem? Does anyone have a workaround? Thanks! Sincerely, Henrik Pettersen Advanced Computation Laboratory Cancer Research UK -- 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
|
Henrik,
On 10/24/06, Henrik Pettersen <[hidden email]> wrote: > Index: <xforms:output value="index('test-repeat')"/>, > Position: <xforms:output value="position()"/> Alternatively, try: <xforms:output value="count(preceding-sibling::aspic:input) + 1"/> Alex -- Blog (XML, Web apps, Open Source): 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
In reply to this post by Henrik Pettersen
Herik,
It is because the position() will return the
position of the sequence in xforms:input, where there is only one. Using an
xforms:output/@ref="position()" should return the value
expected
Ryan
Ryan
Puddephatt
-- 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 |