Hi Alain.

Thanks for the feedback.  Actually, I found a small quirk with this code.
 In the code you have below, instead of 2 xf:output, if you use just one
with a concat, it works fine.  Looks like after the first xf:output it
looses the cols index.

Anyway, with this problem kind of solved I have another one that maybe you
can help me:  As I display the matrix I need to highlight a cell that
matches a condition for both the row and col.  For example, let's say I
want to highlight in green the cell that has both the row and col with the
word "test".  That means that I need to rely on the position() function to
check the contents of the row and cell, not the index which is updated
every time a node becomes current.   But, position() only applies to the
current context.  So in the inside repeat for the cols I need to check the
content of the row in the outside repeat, but position() does not work.  So
the question is:  how can I reference the position of the outside repeat
while it's happening so I can manipulate the display of the cell?  I tried
instance('irows')/row/position() but it fails.  Hope this makes sense :-)

Thanks
Elias

On Sun, Feb 24, 2013 at 4:35 PM, Alain Couthures <
[email protected]> wrote:

> Hello Elias,
>
>  I'm trying to create a spreadsheet where the rows and columns are in
>> separate instances, something like:
>>
>> <xf:instance id="rows">
>>   <data xmlns="">
>>   <row>
>>      <rowdata>stuff</rowdata>
>>   </row>
>>   <row>
>>     <rowdata>more stuff</rowdata>
>>   </row>
>>     ...
>>     ...
>>   </data>
>> </xf:instance>
>>
>> <xf:instance id="cols">
>>   <data xmlns="">
>>   <col>
>>      <coldata>stuff</coldata>
>>   </col>
>>   <col>
>>     <coldata>more stuff</coldata>
>>   </col>
>>     ...
>>     ...
>>   </data>
>> </xf:instance>
>>
>> <xf:repeat id="rows" nodeset="instance('rows')/row">
>>   <div><xf:output value="./rowdata"/></div>
>>    <xf:repeat id="cols" nodeset="instance('cols')/col">
>>    <div><xf:output value="./coldata"/>
>>         <xf:output value="index('rows')"/><br/>
>>         <xf:output value="index('cols')"/>
>>     </div>
>>   </xf:repeat>
>> </xf:repeat>
>>
>>
>>  There are duplicate ids for instances and repeats and I have rewritten
> this test case like this:
>
> <html xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns="
> http://www.w3.org/1999/xhtml"; xmlns:xhtml="http://www.w3.org/1999/xhtml";
> xmlns:ev="http://www.w3.org/2001/xml-events"; xmlns:xsd="
> http://www.w3.org/2001/XMLSchema";>
>     <head>
>         <title>Indexes</title>
>         <xforms:model>
>             <xforms:instance id="irows">
>                 <data xmlns="">
>                     <row>
>                         <rowdata>datar1</rowdata>
>                     </row>
>                     <row>
>                         <rowdata>datar2</rowdata>
>                     </row>
>                 </data>
>             </xforms:instance>
>             <xforms:instance id="icols">
>                 <data xmlns="">
>                     <col>
>                         <coldata>datac1</coldata>
>                     </col>
>                     <col>
>                         <coldata>datac2</coldata>
>                     </col>
>                 </data>
>             </xforms:instance>
>         </xforms:model>
>     </head>
>     <body>
>         <xforms:repeat id="rows" nodeset="instance('irows')/row">
>             <div><xforms:output value="./rowdata"/></div>
>             <xforms:repeat id="cols" nodeset="instance('icols')/col">
>                 <div><xforms:output value="./coldata"/>
>                     <br/>
>                     Current row:<xforms:output value="index('rows')"/><br/>
>                     Current col:<xforms:output value="index('cols')"/>
>                 </div>
>             </xforms:repeat>
>         </xforms:repeat>
>     </body>
> </html>
>
> I can see an issue with the index() function for the cols repeat because
> clicking on the last column item in the second row does not have any effect
> on this index.
>
> I think that it is because it is a cloned node and I can surely fix this.
>
> Are you in a hurry?
>
> -Alain
>
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to