jocsch
10-13-2004, 12:53 AM
Hi everybody,
I want to show a xml nested tree in a "flat view" (everything on the same level, no tree). I thought I would be able to do this with the "//element" xpath selector which should simply select all elements in the tree (even if they are at different levels, according to the xpath doc).
But doing so shows only the first level elements. Please have look at the example. May be I'm doing the //hobbit at the wrong place (using laszlo the first time).
<canvas width="450" height="250">
<include href="lz/tree.lzx"/>
<dataset name="ancestors">
<hobbit name="Frodo">
<hobbit name="Drogo">
<hobbit name="Fosco" grandparent="true"/>
<hobbit name="Bolger, Ruby" grandparent="true"/>
</hobbit>
<hobbit name="Brandybuck, Primula">
<hobbit name="Brandybuck, Gorbadoc" grandparent="true"/>
<hobbit name="Took, Mirabella" grandparent="true"/>
</hobbit>
</hobbit>
<hobbit name="teat"/>
</dataset>
<view x="20" y="20" layout="axis: x; spacing: 10">
<!-- flat tree -->
<view datapath="ancestors:/" bgcolor="#00bb00" layout="axis: y;spacing: 5">
<view datapath="//hobbit">
<text datapath="@name" />
</view>
</view>
<!-- data replicated tree -->
<view width="200" height="200">
<tree datapath="ancestors:/" icon="null" showroot="false">
<tree datapath="*" icon="null" text="$path{'@name'}"
isleaf="$path{'@grandparent'}"/>
</tree>
</view>
</view>
</canvas>
Thanks,
Markus
I want to show a xml nested tree in a "flat view" (everything on the same level, no tree). I thought I would be able to do this with the "//element" xpath selector which should simply select all elements in the tree (even if they are at different levels, according to the xpath doc).
But doing so shows only the first level elements. Please have look at the example. May be I'm doing the //hobbit at the wrong place (using laszlo the first time).
<canvas width="450" height="250">
<include href="lz/tree.lzx"/>
<dataset name="ancestors">
<hobbit name="Frodo">
<hobbit name="Drogo">
<hobbit name="Fosco" grandparent="true"/>
<hobbit name="Bolger, Ruby" grandparent="true"/>
</hobbit>
<hobbit name="Brandybuck, Primula">
<hobbit name="Brandybuck, Gorbadoc" grandparent="true"/>
<hobbit name="Took, Mirabella" grandparent="true"/>
</hobbit>
</hobbit>
<hobbit name="teat"/>
</dataset>
<view x="20" y="20" layout="axis: x; spacing: 10">
<!-- flat tree -->
<view datapath="ancestors:/" bgcolor="#00bb00" layout="axis: y;spacing: 5">
<view datapath="//hobbit">
<text datapath="@name" />
</view>
</view>
<!-- data replicated tree -->
<view width="200" height="200">
<tree datapath="ancestors:/" icon="null" showroot="false">
<tree datapath="*" icon="null" text="$path{'@name'}"
isleaf="$path{'@grandparent'}"/>
</tree>
</view>
</view>
</canvas>
Thanks,
Markus