PDA

View Full Version : Get the current node during replication


vernid
10-08-2007, 08:31 AM
Hi,

I have by example a view with a datapath describing multiple node then the replication mechanism starts.

I would like somehow get the current replicated node to modify its rendering depending on a condition based on the node itself?

Does somebody has an idea?

Regards
Dominique

vernid
10-10-2007, 09:21 AM
Pop up....

monkeytroy
10-11-2007, 09:34 AM
notzippy (user) gave me this code as an example to do something similar..

it renders using classes bc or gc (blue color or green color) based on data in the replicated nodes. So if the node is a b node it uses bc class and g node uses gb class.


<canvas height="500" width="500">
<dataset name="aaaa">
<r>
<a><b/></a>
<a><g/></a>
<a><b/></a>
<a><g/></a>
</r>
</dataset>
<class name="gc" width="30" height="30" bgcolor="green"/>
<class name="bc" width="30" height="30" bgcolor="blue"/>
<view layout="axis:y;spacing:10" datapath="aaaa:/r">
<view datapath="a">
<bc datapath="b"/>
<gc datapath="g"/>
</view>
</view>
</canvas>


I ended up using an attribute in my xml to determine the class since my nodes were named the same.

So my replicated code looks like

<bc datapath="./[@color='b']"/>
<gc datapath="./[@color='g'"/>


Hope this helps.

vernid
10-11-2007, 01:09 PM
Thanks, I tought about this solution but it only works if the condition is based on an attribute, I'm looking for a way to do it based on the value of a child node by example!

Any thanks for your dedication.

Dominqiue