<?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">
</modify-attr>
</modify>
</xsl:variable>
<xsl:variable name="dummy2"
select="cmd:execute($srcCommandProcessor, $dummy)"/>
</xsl:template>
</xsl:transform>
6.5 Using Extension Functions
XSLT is an excellent tool for performing some kinds of transformations and a rather poor tool for
other types of transformations, such as non-trivial string manipulation and iterative processes.
However, the Novell XSLT processor implements extension functions that allow the style sheet to
call a function implemented in Java, and by extension, any other language that can be accessed
through JNI.
For specific examples, see
following example that illustrates using Java for string manipulation. The long lines are wrapped
and do not begin with a <. To view the style sheet, see
Extension_Functions.xsl).
<!-- get-dn-prefix places the part of the passed dn that -->
<!-- precedes the last occurrence of '\' in the passed dn -->
<!-- in a result tree fragment meaning that it can be
<!-- used to assign a variable value
<xsl:template name="get-dn-prefix" xmlns:jstring="http://
www.novell.com/nxsl/java/java.lang.String">
<add-value>
<value type="string">Engineering</value>
</add-value>
"Query Processors" on page 56
using the query processor, and the
Extension_Functions.xsl (../samples/
-->
-->
Defining Policies by Using XSLT Style Sheets
57