|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Help with recursion (was: my brain is hurting)
Hi all
Sorry about the subject line - my brain was more off than hurting, and looking at the instance I gave, I wonder why I wrote that at all. I had only just joined the list, and so didn't see David's mail about meaningful subject lines (which I should have used anyway). Sorry Let my try clear up my own confusion (as I was writing from home where I didn't have my instance in front of me) I have two (or more) separate subtrees in the instance. The first, <users>, defines users and group and the relationship between them, and looks like: <users>
<user name="chris" parent="othergroup">
...
</user>
<user name="phil" parent="othergroup">
...
</user>
<group name="default" parent="">
...
</group>
<group name="othergroup" parent="default">
...
</group>
</users>The ... are to refer to extra nodes regarding the user not important here (such as full name, password, etc) Then there is the <settings> subtree (there could be more than on such subtree, with settings for a different aspect of the user). I cannot merge the settings subtrees with the users subtrees, though (ie, I cannot have the settings per user under the <user> node the the <users> subtree). Design decision out of my hands. the <settings> subtree looks like (fixed from first mail, and have renamed some nodes for legibility) <modulesettings>
<user name="chris">
<module useparent="1" >
...empty...
</module>
</user>
<user name="phil">
<module useparent="0" >
...module settings...
</module>
</user>
<group name="default">
<module useparent="0" >
...module settings...
</module>
</group>
<group name="othergroup">
<module useparent="1" >
...empty...
</module>
</group>
</settings>the 'useparent' attribute specifies if that user or group should inherit its settings from its parent (1), or if it should specify its own (0). I am trying to get a list of users per group who should use the settings defined by that group. I iterate over each group name, and run the transform with <param name='group'/>, passing in each group name in turn. In the above case, user 'phil' is not inheriting setting from the parent, and as such wont appear in the list for any group. User 'chris' is inheriting from group 'othergroup', which is in turn inheriting from group 'default'. So, the user list for group 'default' should contain the user 'chris'. The user list list for group 'othergroup' should be empty, as it has no settings of its own. Hope that makes more sense! I know I should be using recursion here, but I can't get my mind around the xsl way of doing things. Thanks Chris Geert Josten wrote: Hi Chris,
|
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
|

Cart








