Modifying User Variables Through Watson Explorer Engine XML

User variables can easily be modified by the query-meta application by just setting them to different values. This is usually done in the main macro, which is processed each time query-meta is run (the script will save the user profile before terminating and destroying the Watson™ Explorer Engine object).

For example, imagine that you want to collect the users' emails from an active directory (rather than requiring the users to enter the emails in their profile). You can add the following code into the main macro (substituting appropriate authentication details for your organization):

  <set-var name="user.email">
    <parse username="bindinguser" password="bindingpassword"
           cache-read="10000" cache-write="10000" >
      <attribute name="url">
        <scope>ldap://ldapserver.domain.com/dc=emea,dc=intra?mail?sub?(sAMAccountName=</scope>
        <value-of-var name="user.name"/>
        <scope>)</scope>
      </attribute>
      <parser type="html-xsl">
        <xsl:output method="text"/>
        <xsl:template match="/">
          <xsl:value-of select="normalize-space(substring-after(str:tokenize(//text(), '&#10;')[contains(., 'mail:')],'mail:'))"/>
        </xsl:template>
      </parser>
    </parse>
  </set-var>