Hi all

Im using idm 3.01 with an authentication tree idvault connected to a
mysql 4 datatbase. My problem is that that i cannot call stored
procedures from the driver as it is only version 4 and stored procedures
and triggers are not supported.

Therefore I am trying to use a style sheet to do the following:

When a group is added to a user the style sheet should add the
sourcename() of the group added plus the cn of the user to a table which
isnt schema matched.

I have idm working so that users get added to groups in the LDAP tree,
when they are added or removed from groups i need to do an insert for an
add and a delete on a remove.

The problems i am having is that is being funny about the xsl:when
location and also it wont read the CN from the object. Dont think the
'when' statement ever becomes true, what it is supposed to do is become
true if there is a value in group membership removed, ie when it has
been deleted. Any ideas?

<Xxml version="1.0" encoding="UTF-8"?><xsl:stylesheet
exclude-result-prefixes="query cmd dncv" version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><!-- parameters passed
in from the DirXML engine -->
<xslaram name="srcQueryProcessor"/>
<xslaram name="destQueryProcessor"/>
<xslaram name="srcCommandProcessor"/>
<xslaram name="destCommandProcessor"/>
<xslaram name="dnConverter"/>
<xslaram name="fromNds"/>
<!-- identity transformation template -->
<!-- in the absence of any other templates this will cause -->
<!-- the stylesheet to copy the input through unchanged to the output -->
<xsl:template match="node()|@*">
<xsl:apply-templates select="@*|node()"/>
<!-- add your custom templates here -->
<xsl:template match="modify[@class-name='User']"
<xsl:apply-templates select="@*|node()"/>
<xsl:variable name="CN"
<xsl:variable name="GroupMem"
select="modify-attr[@attr-name='Group Membership']/add-value/value"/>
<xsl:message>Starting: Add Student to course</xsl:message>
<!-- <xsl:variable name = "test"/> -->
<xsl:when test="modify-attr[@attr-name=’Group Membership’]/remove-value">
<jdbc:statement jdbc:type="update">
<xsl:value-of select="/nds/input/*/association"/>
<xsl:text>DELETE FROM mdl_role_assignments </xsl:text>
<xsl:text>WHERE userid = </xsl:text>
<xsl:value-of select="$CN"/>
<xsl:text>AND contextidlevel = </xsl:text>
<xsl:value-of select="$GroupMem"/>
<jdbc:statement jdbc:type="update">
<xsl:value-of select="/nds/input/*/association"/>
<xsl:text>INSERT INTO mdl_role_assignments</xsl:text>
<xsl:text>(roleid, userid, contextidlevel)</xsl:text>
<xsl:text>VALUES (3,</xsl:text>
<xsl:value-of select="$CN"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$GroupMem"/>


Thanks in advance