One question -- what does the attribute @files mean on
the folder element whose @id="dir1"? It has @files="4",
but that doesn't seem to enter into the calculation you're
doing. So the semantics of the XML are a little unclear to me.
Sorry, I guess the example was a little unclear. I want to sum the files
attribute for *all* folders under the initial parent. So the result I'd want
from dir0 would be 25. The sum of the file attributes of all the folder
elements is 27.
Is that a little clearer?
To rephrase the above question, are you just summing the attributes
of leaf folders (as you appear to be in your example where you
expect the answer to be 9)?
All branches and leaves, but not the trunk. (where an arbitrary starting point
is the trunk)
Here's an example:
<root>
<folder files="2" id="dir0">
<file id="dir1" />
<file id="dir4" />
</folder>
<folder files="4" id="dir1">
<file id="dir2" />
<file id="dir3" />
</folder>
<folder files="3" id="dir2" />
<folder files="6" id="dir3" />
<folder files="7" id="dir4" />
<folder files="5" id="dir5" />
</root>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list