[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

One nodeset, multiple branches

Subject: One nodeset, multiple branches
From: Eric Vitiello <xsl-list@xxxxxxxxxxxx>
Date: Wed, 19 Dec 2001 09:22:49 -0500
 One nodeset
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.