xsl-list
[Top] [All Lists]

Re: [xsl] XML access control by custom ID

2010-03-16 03:44:34
Dear Jacobus,

If you substitute 'users' with 'root' in the stylesheet, the example will work.

xsl:key works as follows here: given the string 'anybody--1', the xsl:key function will return any my_id (below the root node of access.xml) whose value (calculated according to the use attribute of the xsl:key element) is 'anybody--1'. Then it will go up one level from there and return the name(s) of the elements specifying the type of right (read, write) as a sequence of strings. This sequence (in the current example, it's only one item, 'read'), concatenated by space, will constitute the access attribute of the data element whose id is 1 (for the current user, which is anybody).

Gerrit


On 16.03.2010 09:09, Jacobus Reyneke wrote:
-----------Your stylesheet:--------
  <xsl:template match="users/*"/><!-- ignore by default -->

  <!-- process accessible nodes: copy and add @access -->
  <xsl:template match="users/*[ @my_id = $accessible ]" priority="1">


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--