it is possible to convert a tree structrure to xml/html list with the
tree.traverse_group function
these examples come from the tutorial.txt
SAMPLE TREE DATA STRUCTURE FROM THE TUTORIAL:
you can see the tutorial.txt for more information about this structure
category 1
/ \
/ \
category 1.2 category 1.2
|
|
category 1.2.1
#SELECT
CASE
WHEN group_tag = 1 THEN '
'
WHEN group_tag = 2 THEN '
'
WHEN group_tag is null THEN '' || node_data_id || ''
END AS tags
from tree.traverse_group(1,8,true) t ;
tags
------------
(10 rows)
#SELECT
CASE
WHEN group_tag = 1 THEN ''
WHEN group_tag = 2 THEN '
'
WHEN group_tag is null THEN '' || d.cat_name || ''
END AS tags
from tree.traverse_group(1,8,true) t LEFT JOIN public.category d ON (t.node_data_id = d.id) order by traversal_index ;
tags
-------------------------
- category 1
- category 1.1
- category 1.2
(10 rows)
HTML RENDERING:
* category 1
o category 2
+ category 4
o category 3
#SELECT
CASE
WHEN group_tag = 1 THEN ''
WHEN group_tag = 2 THEN '
'
END AS grou_tags, d.cat_name
from tree.traverse_group(1,8,true) t LEFT JOIN public.category d ON (t.node_data_id = d.id) order by traversal_index ;
grou_tags | cat_name
-----------+----------------
|
| category 1
|
| category 1.1
|
| category 1.2
|
|
(10 rows)