position() function not working within @label of xforms control?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

position() function not working within @label of xforms control?

Henrik Pettersen
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
Reply | Threaded
Open this post in threaded view
|

Re: position() function not working within @label of xforms control?

Alessandro  Vernet
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
Reply | Threaded
Open this post in threaded view
|

RE: position() function not working within @label of xforms control?

Ryan Puddephatt
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
Software Engineer
 

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP
 
e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108
w> www.teleflex.com

 


From: Henrik Pettersen [mailto:[hidden email]]
Sent: 24 October 2006 22:28
To: [hidden email]
Subject: [ops-users] position() function not working within @label of xforms control?

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