[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] [no subject]Element g contains h and i only, which are defined (result="true" in both giving g's result attribute a value of true). >>> correct c,d,h,i are defined in the data.xml and therefore @complete="true". Also they are the only childs of elements b and g, which means that b and g are also complete. >>> correct The element f is not defined in the data.xml file, and it does not have any children that are defined in the file. Therefore @result is undefined (result=""). Nor is it complete (complete="false"). >>> correct - in this case the value of @result is not significant to me because @complete="false". Element e contains both f and g. It seems you do not AND result values that are NULL (empty string), so e's attribute result="true". But complete="false" because that is the value of f's complete attribute. >>> correct - I made the decision that even if @complete="false", as long as all descendants that have @complete="true" also have @result="true", then the current node's @result value would be "true" a contains b and e. Because @result is true in e but false in b and visa versa for @complete, these attributes both become false in the element a. >>> correct Have I understood your problem? >>> very well, thank you - I tried to include all possible scenarios in as short an example as possible. Regards, Ragulf Pickaxe :-) On 4/20/07, Simon Shutter <simon@xxxxxxxxxxx> wrote: > Dimitre, > > I believe I do know what the problem is and I'm sorry I've been unable to > communicate it clearly enough in my previous posts. > > Let me try again. > > I have a known tree structure. Let's say it's stored in a file tree.xml. > It looks like this: > > <a> > <b> > <c/> > <d/> > </b> > <e> > <f/> > <g> > <h/> > <i/> > </g> > </e> > </a> > > I have an application that generates boolean values (stored in an attribute > called "result") for a number of data elements. The element names > correspond to the leaf node elements in the tree structure above. Let's say > they are are stored in a file data.xml that looks like this: > > <data> > <c result="true"/> > <d result="false"/> > <h result="true"/> > <i result="true"/> > </data> > > Data.xml does not have to contain an element for each leaf node in the > tree.xml. > > I am interested in constructing an output tree that has the same structure > as the tree above based only on the leaf node data. To prevent ambiguity > there can only be one instance of each element in tree.xml. > > The idea is that if all descendants of a node have a result attribute = > "true" then the result attribute value of that node is true also. Ken > identified this in his opening paragraph even though I didn't make it clear. > > In addition to the logical AND calculation, I also want to indicate where > leaf nodes are missing and that is where the "complete" attribute comes in. > So the output tree should indicate nodes that have missing descendants as > well as the logical AND result. In the example I used, the desired output > tree is: > > <a complete="false" result="false"> > <b complete="true" result="false"> > <c complete="true" result="true"/> > <d complete="true" result="false"/> > </b> > <e complete="false" result="true"> > <f complete="false" result=""/> > <g complete="true" result="true"/> > <h complete="true" result="true"/> > <i complete="true" result="true"/> > </g> > </e> > </a> > > So in answer to your question, the element f can be absent from data.xml but > it needs to be in the output tree so it can identified as missing when the > output tree is transformed to HTML. That is why all the leaf nodes have a > "complete" attribute. > > Perhaps it is my choice of attributes that has caused confusion here. > Anyhow, I hope that this attempt to outline my requirements makes more sense > than the original post. > > Regards, Simon
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|