[xsl] Ordering "roles"

Subject: [xsl] Ordering "roles"
From: Phillip B Oldham <phillip.oldham@xxxxxxxxxx>
Date: Wed, 16 Aug 2006 16:06:55 +0100
Hi guys

I've got some xml in the following structure:

<roles>
   <role>
      <name>Create</name>
      <hasroles />
   </role>
   <role>
      <name>Approve</name>
      <hasroles>
         <include>Create</include>
         <include>Edit</include>
      </hasroles>
   </role>
   <role>
      <name>Edit</name>
      <hasroles>
         <include>Create</include>
      </hasroles>
   </role>
</roles>

So from this we can see that if your role is Edit, you can also Create.

I need to produce an ordered list which takes into account the above statement, such as:

<ul>
   <li>Create</li>
   <li>Edit</li>
   <li>Approve</li>
</ul>

Approve coming last in the list because it "includes" the above two, Edit below that because it "includes" Create, and so on.

I'm using XSL1 with EXSLT.

Any ideas on how I can accomplish my goals?

Current Thread