Hi,
I've been trying all day to get the following code to work and keep on encountering problems - is there a better way of doing it?
I have a Menu node which contains an allowedUserRoles node. This sub-node may have multiple authority/role attributes. I pass in an authority parameter to the XSL and onl;y want to continue processing the Node if the authority/role attribue is blank, or if one of the authority/role attributes matches the parameter. I have created an attribute to store the true/false, but when I test the attribute's value in the XSL, it is blank - although the correct value is appearing in the generated HTML???
Any help/suggestions would be greatly appreciated.
Jeremy
The XML looks as follows:
The XSL code is:
I've been trying all day to get the following code to work and keep on encountering problems - is there a better way of doing it?
I have a Menu node which contains an allowedUserRoles node. This sub-node may have multiple authority/role attributes. I pass in an authority parameter to the XSL and onl;y want to continue processing the Node if the authority/role attribue is blank, or if one of the authority/role attributes matches the parameter. I have created an attribute to store the true/false, but when I test the attribute's value in the XSL, it is blank - although the correct value is appearing in the generated HTML???
Any help/suggestions would be greatly appreciated.
Jeremy
The XML looks as follows:
Code:
<menus>
<menu id="eNew">
<description>Main Menu</description>
<allowedUserRole>
<authority />
</allowedUserRole>
<contents>
<menu id="e1">
<description>Customers</description>
<allowedUserRole>
<authority>
<role>user2</role>
</authority>
<authority>
<role>manager</role>
</authority>
</allowedUserRole>
</menu>
</contents>
</menu>
</menus>
The XSL code is:
Code:
<xsl:template match="menu">
<div onselectstart="return false" ondragstart="return false">
<xsl:attribute name="allowedItem">false</attribute>
<xsl:for-each select="./allowedUserRole">
<xsl:for-each select="./authority">
<xsl:choose>
<xsl:when test="string(role) = ''">
<xsl:attribute name="allowedItem">true</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:if test="string(role) = $p_Authority">
<xsl:attribute name="allowedItem">true</xsl:variable>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
<xsl:choose>
<xsl:when test="allowedItem = 'true'">
.....continue processing node