DirXML Calling Custom Java Functions


Be sure the DirXML Script namespace definitions are set within the policy where using the Java call.

Shows a DirXML Example and XPATH Example for working with DirXML Calling Custom Java Functions.

You will also need to place the Java jar files in the correct location.

Calling Java From DirXML#

An example where we show how we did UUID Generation in DirXML Calling Java Example from a driver.

An example where we show how we used our Unique Value Finder tool from a driver

DirXML 3.01 and Earlier#

Each of the following headings defines an XML namespace for an external Java method. Add it as an attribute on your policy or XSLT template.

One or more examples of how to use the available methods follow each XML namespace.


			<do-set-local-variable name="userMembershipList">
					<token-xpath expression='query:readObject($srcQueryProcessor, "", @src-dn, "User", "Group Membership")'/>


			<do-set-local-variable name="timestamp">
					<token-xpath expression="date:new()"/>
			<do-set-local-variable name="timestamp">
					<token-xpath expression="round(date:getTime($timestamp) div 1000)"/>


This calls out to a custom Java class. You can view the ConvCase.Java Source Code.
	<xsl:variable name="jconvCaseInstance" select="jconvCase:new()"/>
	<xsl:value-of select="jconvCase:toTitleCase($jconvCaseInstance,$toconvert)"/>


	<xsl:value-of select="jstring:toLowerCase($toconvert)"/>
	<xsl:value-of select="jstring:toUpperCase($toconvert)"/>
	<xsl:variable name="dn" select="jstring:new($src-dn)"/>
	<xsl:variable name="index" select="jstring:lastIndexOf($dn,'\')"/>
	<xsl:if test="$index != -1">
		<xsl:value-of select="jstring:substring($dn,$index + 1)"/>


	<!-- The ncs:getTimeString() function is a simple java function in the DirXMLNCUtils.jar file -->
	<!-- The function returns the system time in the following format yyyymmddhhmmss -->
	<!-- When the NDS timestamp is used, it must be converted from NDS time to a string -->
	<!-- NDS timestamps are stored as the number of seconds since 1/1/1970 followed by a # then a replica number -->
	<!-- The # and replica number are stripped out by the substring-before XSLT function -->
	<xsl:value-of select="ncs:getTimeString()"/>
	<!-- Here we simply write a message to the DSTrace screen or log if it's running -->
logentry=<xsl:value-of select="ncs:writeLog($logfile,$logmessage)"/>

More Information#

There might be more information for this subject on one of the following: