Overview#
Shows a DirXML Example and XPATH Example for working with Create an Association from Attribute:#
<rule notrace="true"> <description>Create an Association from nwGUID</description> <comment xml:space="preserve">We always create an association and set the entry to Associated</comment> <comment name="author" xml:space="preserve">jim@willeke.com </comment> <comment name="version" xml:space="preserve">5</comment> <comment name="lastchanged" xml:space="preserve">2014-06-24</comment> <conditions> <and> <if-association op="not-associated"/> <if-operation mode="case" op="equal">modify</if-operation> </and> </conditions> <actions> <do-if> <arg-conditions> <and> <if-attr name="nwGUID" op="not-available"/> </and> </arg-conditions> <arg-actions> <do-set-dest-attr-value name="nwGUID"> <arg-value type="string"> <token-xpath expression="jguid:getGuid($idv.dns.name.guidgenerator,$idv.data.guidgenerator.port,$idv.dns.name.guidgenerator)"/> </arg-value> </do-set-dest-attr-value> </arg-actions> <arg-actions/> </do-if> <do-add-association> <arg-dn> <token-src-dn/> </arg-dn> <arg-association> <token-attr name="nwGUID"/> </arg-association> </do-add-association> <do-set-op-association> <arg-association> <token-attr name="nwGUID"/> </arg-association> </do-set-op-association> <do-if> <arg-conditions> <and> <if-association op="available"/> </and> </arg-conditions> <arg-actions> <do-if> <arg-conditions> <and> <if-association op="not-associated"/> </and> </arg-conditions> <arg-actions> <do-set-xml-attr expression="association" name="state"> <arg-string> <token-text xml:space="preserve">associated</token-text> </arg-string> </do-set-xml-attr> </arg-actions> <arg-actions/> </do-if> </arg-actions> <arg-actions/> </do-if> </actions> </rule>