This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

One nodeset, multiple branches


Hi.

I have the following XML:

<?xml version="1.0"?>
<access>
        <users>
                <user username="evitiello">
                        <realName>Eric Vitiello</realName>
                        <rights>
                                <right module="news" access="add"/>
                                <right module="page" access="edit"/>
                        </rights>
                        <userGroups>
                                <group name="administrators"/>
                        </userGroups>
                </user>
        </users>
        <groups>
                <group name="marketing">
                        <rights>
                                <right module="news" access="add"/>
                        </rights>
                </group>
                <group name="administrators">
                        <rights>
                                <right module="news" access="add"/>
                                <right module="news" access="edit"/>
                                <right module="news" access="delete"/>
                                <right module="page" access="add"/>
                        </rights>                
                </group>
        </groups>
</access>

I would like to be able to return a nodeset that contains all of the "rights" that a given user has.

This gets complicated, because it's not simply user[@username='evitiello]/rights/right to get the user's 
rights... I also need to find out what rights they have for the groups they are in.  For example, evitiello is in 
the "administrators" group, so he should also have all the rights listed under the node for 
/groups/group[@name='administrators'].

Therefore, getting the rights for evitiello should return:

                                <right module="news" access="add"/>
                                <right module="page" access="edit"/>
                                <right module="news" access="add"/>
                                <right module="news" access="edit"/>
                                <right module="news" access="delete"/>
                                <right module="page" access="add"/>

Also notice that the <right module="news" access="add"/> node is duplicated because the user itself has the 
right, as well as the group they are in.  I would rather it only return one instance of this right.  The XPath 
should also be able to handle a user that is in multiple groups.

Either this xpath is out of my league, or I'm missing something very simple.

Thanks,

---
Eric Vitiello
Perceive Designs
<www.perceive.net>;


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]