# RE: Constructing a tree from leaf nodes (knowing the t

 Subject: RE: Constructing a tree from leaf nodes (knowing the tree structure)? From: "Simon Shutter" Date: Thu, 19 Apr 2007 23:16:13 -0700
```Trevor,

Thank you for providing a clear, generic problem definition.  I've made a
couple of minor changes to the third bullet in a) and b) and the addition of
a fourth bullet to b).

Regards, Simon

****************************

There is a structure tree and a data tree.
The structure tree is fixed and complete.
The data tree is variable and may contain any element which corresponds to a
descendant-less node (leaf node) in the structure tree (at most one of each
element).

The required output is a merge of the structure tree and the data tree,
where:
a) for any specific descendant-less (leaf) node in the structure tree:
- if the data tree contains a matching node with @result true
then @complete=true and @result=true
- if the data tree contains a matching node with @result false
then @complete=true and @result=false
- if the data tree does not contain a matching node
then @complete=false and @result=true (because I do not want
to affect the logical AND value of ancestor nodes' @result value
when they include leaf nodes with @complete=false - see third bullet
in b) below)

b) for every other internal node in the structure tree:
- if the data tree contains every descendant leaf node with @result true
then @complete=true and @result=true
- if the data tree contains every descendant leaf node but not all
results are true then @complete=true and @result=false
- if every descendant leaf node has @result=true then the internal node
will have @result=true (even if one or more leaf nodes have
@complete=false)
- if any descendant leaf node has @result=false then the internal node
will have @result=false

****************************

-----Original Message-----
From: Trevor Nicholls [mailto:trevor@xxxxxxxxxxxxxxxxxx]
Sent: April 19, 2007 10:51 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Constructing a tree from leaf nodes (knowing the tree
structure)?

As I understand it (sorry if this duplicates other posts submitted
meantime):

There is a structure tree and a data tree.
The structure tree is fixed and complete.
The data tree is variable and may contain any element which corresponds to a
descendant-less node (leaf node) in the structure tree (at most one of each
element).

The required output is a merge of the structure tree and the data tree,
where:
a) for any specific descendant-less (leaf) node in the structure tree:
- if the data tree contains a matching node with @result true
then @complete=true and @result=true
- if the data tree contains a matching node with @result false
then @complete=true and @result=false
- if the data tree does not contain a matching node
then @complete=false and @result=false

b) for every other node in the structure tree:
- if the data tree contains every descendant leaf node with @result true
then @complete=true and @result=true
- if the data tree contains every descendant leaf node but not all
results are true
then @complete=true and @result=false
- if the data tree does not contain every descendant leaf node
then @complete=false and @result=false

Cheers
T

-----Original Message-----
From: Simon Shutter [mailto:simon@xxxxxxxxxxx]
Sent: Friday, 20 April 2007 5:15 p.m.
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Constructing a tree from leaf nodes (knowing the tree
structure)?

Dimitre,

I've done my best.  Perhaps someone who does understand the problem as I've
stated it and who also understands what you need to correctly and
unambiguously define the problem can help bridge the gap here.

Simon

```

### PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!