9.3 Using the Parameters that DirXML Passes

The DirXML engine passes the rule style sheets the following parameters that the style sheet can use. Note that with DirXML 1.1, the query processor parameters are now passed to the schema mapping rules and the input and output transformation rules. The command processor parameters are passed to all rules.

To use these parameters include the following in your style sheet:

With DirXML 1.1, processors will accept a query or command element as the top level element and will wrap it in <input> and <nds> if necessary.

When using the query and command parameters with the schema mapping rules, input transformation rules, and output transformation rules the following limitations apply:

  1. Queries issued to the application shim must be in the form expected by the application shim. In other words, schema names must be in the application namespace and the query must conform to whatever XML vocabulary is used natively by the shim. No association refs will be added to the query.
  2. Responses from the application shim will be in the form returned by the shim with no modification or schema mapping performed and no resolution of association refs.
  3. Queries issued to NDS must be in the form expect by NDS. In other words schema names must be in the NDS namespace and the query must be XDS. Association refs will not be resolved.
  4. Responses from the application shim will be in the form returned by the shim with no modification or schema mapping performed.

Query Processors

Use of the query processors depends on the Novell XSLT implementation of extension functions. To make a query, you need to declare a name space for the XdsQueryProcessor interface. This is done by adding the following to the <xsl:stylesheet> or <xsl:transform> element of the style sheet.

  xmlns:query="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsQueryProcessor"
  

The following example uses one of the query processors (the extra long lines are wrapped and do not begin with a <):

  <!-- Query object name queries NDS for the passed object -->
  <!-- name. Ideally, this would not depend on "CN": to do -->
  <!-- this, add another parameter that is the name of the   -->
  <!-- naming attribute.                                     -->
  
  <xsl:template name="query-object-name">
     <xsl:param name="object-name"/>
  
  <!-- build an xds query as a result tree fragment -->
     <xsl:variable name="query">
        <nds ndsversion="8.5" dtdversion="1.0">
           <input>
              <query>
                 <search-class class-name="{ancestor-or-self:
                       :add/@class-name}"/>
  
  <!-- NOTE: depends on CN being the naming attribute -->
                 <search-attr attr-name="CN">
                     <value><xsl:value-of select="$object-name"/
                          ></value>
                 </search-attr>
  <!-- put an empty read attribute in so that we don’t get -->
  <!-- the whole object back                               -->
                 <read-attr/>
              </query>
           </input>
        </nds>
     </xsl:variable>
  
  <!-- query NDS -->
  <xsl:variable name="result" select="query:query($destQuery
       Processor,$query)"/>
  
  <!-- return an empty or non-empty result tree fragment -->
  <!-- depending on result of query                      -->
     <xsl:value-of select="$result//instance"/>
  </xsl:template>
  

Command Parameters

In order to allow channel write-back for default attributes added by a create rule, a new XML attribute called write-back was added to the <required-attr> element of the Create Rule. If present and set to true, the create rule will call the srcCommandProcessor with a modify command to write the default value back to the source.

The following example uses command parameters to perform a write back operation.

  <?xml version="1.0"?>
  <xsl:transform 
         		version="1.0"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         xmlns:cmd="http://www.novell.com/nxsl/java
         com.novell.nds.dirxml.driver.XdsCommandProcessor"
  >
  <xsl:param name="srcCommandProcessor"/>
  
  <xsl:template match="node()|@*">
       <xsl:copy>
            		<xsl:apply-templates select="@*|node()"/>
       	</xsl:copy>
  </xsl:template>
  
  <xsl:template match="add">
       	<xsl:copy>
            		<xsl:apply-templates select="@*|node()"/>
       	</xsl:copy>
  
  	<!-- on a user add, add Engineering department to the source object -->
  	<xsl:variable name="dummy">
       		<modify class-name="{@class-name} "dest-dn="{@src-dn}">
            			<xsl-copy-of select="association"/>
            			<modify-attr attr-name="OU">
                 			<add-value>
                      					<value type="string">Engineering</value>
                  				</add-value>
            			</modify-attr>
  		</modify>
  	</xsl:variable>
       	<xsl:variable name="dummy2"
           select="cmd:execute($srcCommandProcessor, $dummy)"/>
  </xsl:template>
  
  </xsl:transform>