mericson
10-16-2004, 08:14 AM
I'm trying to build a browser like interface onto some XML. Unfortunately doing replication dynamically isn't working like I would hope. The following works but of course the second list only works if the <a> element contains only a single <b> child.
I really want to pass the appropriate datapath to the second list. I really don't want to be constructing absolute XPaths either, this should all work relative.
Any suggestions?
<canvas debug="true" height="200" width="500">
<dataset name="dset">
<data>
<a name="a1">
<b name="a1.b1">a1.b1.text</b>
</a>
<a name="a2">
<b name="a2.b1">a2.b1.text</b>
<b name="a2.b2">a2.b2.text</b>
</a>
</data>
</dataset>
<simplelayout axis="x" spacing="10"/>
<view>
<simplelayout axis="y" spacing="2"/>
<text><b>A</b></text>
<list id="A" height="100" width="50">
<textlistitem text="$path{'@name'}" value="$path{'@name'}"
onclick="B.datapath.setPointer(this.datapath.p)">
<!-- Pointer is only a single node, would rather do something like this...
onclick="B.setDatapath(this.datapath)" >
-->
<datapath xpath="dset:/data/a" pooling="true">
</datapath>
</textlistitem>
</list>
</view>
<view>
<simplelayout axis="y" spacing="2"/>
<text><b>B</b></text>
<list id="B" height="100" width="50" >
<datapath pooling="true"/>
<textlistitem text="$path{'b/@name'}" value="$path{'b/@see'}"/>
</list>
</view>
</canvas>
I really want to pass the appropriate datapath to the second list. I really don't want to be constructing absolute XPaths either, this should all work relative.
Any suggestions?
<canvas debug="true" height="200" width="500">
<dataset name="dset">
<data>
<a name="a1">
<b name="a1.b1">a1.b1.text</b>
</a>
<a name="a2">
<b name="a2.b1">a2.b1.text</b>
<b name="a2.b2">a2.b2.text</b>
</a>
</data>
</dataset>
<simplelayout axis="x" spacing="10"/>
<view>
<simplelayout axis="y" spacing="2"/>
<text><b>A</b></text>
<list id="A" height="100" width="50">
<textlistitem text="$path{'@name'}" value="$path{'@name'}"
onclick="B.datapath.setPointer(this.datapath.p)">
<!-- Pointer is only a single node, would rather do something like this...
onclick="B.setDatapath(this.datapath)" >
-->
<datapath xpath="dset:/data/a" pooling="true">
</datapath>
</textlistitem>
</list>
</view>
<view>
<simplelayout axis="y" spacing="2"/>
<text><b>B</b></text>
<list id="B" height="100" width="50" >
<datapath pooling="true"/>
<textlistitem text="$path{'b/@name'}" value="$path{'b/@see'}"/>
</list>
</view>
</canvas>