<?xml version='1.0'?>
<!--Copyright 2004 Intuit Inc. All rights reserved. Unauthorized duplication is a violation of applicable law.-->
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                xmlns:foo="http://www.broadbase.com/foo"
                extension-element-prefixes="msxsl"
                exclude-result-prefixes="foo">			
<xsl:output method="html" indent="yes" />
<msxsl:script language="javascript" implements-prefix="foo">
<![CDATA[
var rowColor = "#ffffff";
   function whichColor(e) {
	 if (rowColor == "#ffffff")
      rowColor = "#EFEFEF";
    else
      rowColor = "#ffffff";
	return rowColor;
  }
   function curColor(e) {
      return rowColor;
  }
]]>
</msxsl:script>

<xsl:template match="ViewPermissionsXML">	
	
	<table align="center" width="100%" border="0" cellpadding="0" cellspacing="8">
	<tr><td align="center" class="companyheader"><xsl:value-of select="Company"/></td></tr>
	<tr><td align="center" class="companyheader"><xsl:value-of select="Date"/></td></tr>
	<tr><td align="center" class="bigheader"><xsl:value-of select="Title"/></td></tr>
	</table>
	<xsl:choose>
	<xsl:when test="./User">
	<xsl:call-template name="ListTable" />
	</xsl:when>
	<xsl:otherwise>
	<xsl:call-template name="NoUsers" />
	</xsl:otherwise>
	</xsl:choose>	
</xsl:template>

<xsl:template name="NoUsers">	
<BR/><BR/>
<table width="93%" class="listtable" cellpadding="6" cellspacing="0">
	<tr><td align="center" class="companyheader">No User Or Permissions Data Available</td></tr>
	</table>
</xsl:template>

<xsl:template name="ListTable">
<table width="93%" class="listtable" cellpadding="3" cellspacing="0">
<xsl:call-template name="ListItems" />
</table>
</xsl:template>


<xsl:template name="ListItems">	

<!-- 1st Indent is User -->
<!-- 2nd Indent is Role -->
<!-- Level 1+ are Areas ans Sub-Areas -->	
	<TR>
		<TD width="60%">&#xa0;</TD>
		<TD width="40%" class="listheader" nowrap="yes">&#xa0;</TD>
	</TR>
	<TR>
		<TD width="60%">&#xa0;</TD>
		<TD width="40%" class="listheader" nowrap="yes">Access Level</TD>
	</TR>
	
	<!-- USER -->
	<xsl:for-each select="User">
	<TR>
	<xsl:attribute name="style">background-color:<xsl:value-of select="foo:whichColor()"/></xsl:attribute>
		<TD align="left" class="listitembold" nowrap="yes">
		<img src="blank.gif" border="0" width="30" height="0" />
		<xsl:value-of select="@name"/>
		</TD>
		<TD align="left" class="listaction" nowrap="yes">&#xa0;&#xa0;
		<xsl:value-of select="@action"/>
		</TD>
	</TR>
	<xsl:choose>
	<xsl:when test="./Role">
	<xsl:call-template name="ListRoles" />
	</xsl:when>
	<xsl:otherwise>
	<TR>
	<xsl:attribute name="style">background-color:<xsl:value-of select="foo:whichColor()"/></xsl:attribute>
		<TD align="left" class="listitem" nowrap="yes">
		<img src="blank.gif" border="0" width="60" height="0" />
		There are no roles assigned to this user.
		</TD>
		<TD align="left" class="listaction" nowrap="yes">&#xa0;&#xa0;
		</TD>
	</TR>
	</xsl:otherwise>
	</xsl:choose>

	<xsl:if test="position()!=last()">
	<!-- 2 Blank Rows Between Users -->
	<TR>
	<xsl:attribute name="style">background-color:<xsl:value-of select="foo:whichColor()"/></xsl:attribute>
	<TD align="left" class="listitembold" nowrap="yes">&#xa0;</TD>
	<TD align="left" class="listaction" nowrap="yes">&#xa0;</TD>
	</TR>
	<TR>
	<xsl:attribute name="style">background-color:<xsl:value-of select="foo:whichColor()"/></xsl:attribute>
	<TD align="left" class="listitembold" nowrap="yes">&#xa0;</TD>
	<TD align="left" class="listaction" nowrap="yes">&#xa0;</TD>
	</TR>
	</xsl:if>
		
	</xsl:for-each>
</xsl:template>		
	
<xsl:template name="ListRoles">	

	<xsl:for-each select="Role">
	<xsl:choose>
	<xsl:when test="./Entitlement">
	<TR>
	<xsl:attribute name="style">background-color:<xsl:value-of select="foo:whichColor()"/></xsl:attribute>
		<TD align="left" class="listitembold" nowrap="yes">
		<img src="blank.gif" border="0" width="60" height="0" />
		<xsl:value-of select="@name"/>
		</TD>
		<TD align="left" class="listaction" nowrap="yes">&#xa0;&#xa0;
		<xsl:value-of select="@action"/>
		</TD>
	</TR>
	

	<xsl:call-template name="ListEntitlements" />
	
	<xsl:if test="position()!=last()">
	<!-- 1 Blank Rows Between Roles -->
	<TR>
	<xsl:attribute name="style">background-color:<xsl:value-of select="foo:whichColor()"/></xsl:attribute>
	<TD align="left" class="listitembold" nowrap="yes">&#xa0;</TD>
	<TD align="left" class="listaction" nowrap="yes">&#xa0;</TD>
	</TR>
	</xsl:if>
	</xsl:when>
	
	<xsl:otherwise>
	<TR>
	<xsl:attribute name="style">background-color:<xsl:value-of select="foo:whichColor()"/></xsl:attribute>
		<TD align="left" class="listitembold" nowrap="yes">
		<img src="blank.gif" border="0" width="60" height="0" />
		<xsl:value-of select="@name"/>
		</TD>
		<TD align="left" class="listaction" nowrap="yes">&#xa0;&#xa0;
		<xsl:value-of select="@action"/>
		</TD>
	</TR>
	<TR>
	<xsl:attribute name="style">background-color:<xsl:value-of select="foo:whichColor()"/></xsl:attribute>
		<TD align="left" class="listitem" nowrap="yes">
		<img src="blank.gif" border="0" width="90" height="0" />
		There are no entitlements available for this role.
		</TD>
		<TD align="left" class="listaction" nowrap="yes">&#xa0;&#xa0;
		</TD>
	</TR>
	</xsl:otherwise>
	</xsl:choose>
	</xsl:for-each>
</xsl:template>

<xsl:template name="ListEntitlements">	

	<xsl:for-each select="Entitlement">		
	<TR>
	<xsl:attribute name="style">background-color:<xsl:value-of select="foo:whichColor()"/></xsl:attribute>
		<TD align="left" class="listitem" nowrap="yes">
		<xsl:if test="./@level='1'">
		<img src="blank.gif" border="0" width="90" height="0" />
		</xsl:if>
		<xsl:if test="./@level='2'">
		<img src="blank.gif" border="0" width="120" height="0" />
		</xsl:if>
		<xsl:if test="./@level='3'">
		<img src="blank.gif" border="0" width="150" height="0" />
		</xsl:if>
		<xsl:if test="./@level='4'">
		<img src="blank.gif" border="0" width="180" height="0" />
		</xsl:if>
		<xsl:if test="./@level='5'">
		<img src="blank.gif" border="0" width="210" height="0" />
		</xsl:if>
		<xsl:if test="./@level='6'">
		<img src="blank.gif" border="0" width="240" height="0" />
		</xsl:if>
		<xsl:if test="./@level='7'">
		<img src="blank.gif" border="0" width="270" height="0" />
		</xsl:if>
		<xsl:if test="./@level='8'">
		<img src="blank.gif" border="0" width="300" height="0" />
		</xsl:if>
		<xsl:value-of select="@name"/>
		</TD>
		<TD align="left" class="listaction" nowrap="yes">&#xa0;&#xa0;
		<xsl:value-of select="@action"/>
		</TD>
	</TR>
		</xsl:for-each>
		
</xsl:template>

</xsl:stylesheet>
