[xsl] Changing boolean value of xsl:attribute at runtime? Can it be don e ....

Subject: [xsl] Changing boolean value of xsl:attribute at runtime? Can it be don e ....
From: Brian Moynihan <BMoynihan@xxxxxxxxxx>
Date: Thu, 4 Apr 2002 20:18:11 +0100
Hi,

I've been trying to get the following code to work but I keep on
encountering problems - is there a better way of doing it?

I have a Menu node which contains an allowedUserRole node. This sub-node may
have multiple authority/role attributes. I pass in an authority parameter to
the XSL and only want to continue processing the Node if the authority/role
attribute 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.

The XML looks as follows:

<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:

<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
  




**********************************************************************
Privileged, confidential and/or copyright information may be contained
in this e-mail. This e-mail is for the use only of the intended
addressee. If you are not the intended addressee, or the person
responsible for delivering it to the intended addressee, you may not
copy, forward, disclose or otherwise use it or any part of it in any
way whatsoever. To do so is prohibited and may be unlawful.

If you receive this e-mail by mistake please advise the sender
immediately by using the reply facility in your e-mail software.

Orygen (Ireland) Limited may monitor the content of e-mails sent and
received via its network for the purposes of ensuring compliance with
its policies and procedures.

This message is subject to and does not create or vary any contractual
relationship between Orygen (Ireland) Limited and you.
**********************************************************************



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


Current Thread