Metadirectory 引擎會將樣式表可使用的下列參數傳遞給規則樣式表。
在 iManager 或 Designer 中建立新樣式表時,會以包含這些參數之宣告的樣式表預先填入。
搭配綱要映射規則、輸入轉換規則和輸出轉換規則使用查詢和指令參數時, 會套用下列限制:
查詢處理器的使用會視 Novell® XSLT 的延伸功能實作而定。 若要進行查詢,則需宣告 XdsQueryProcessor 介面的名稱空間。 做法則是將下列項目新增至樣式表的 <xsl:stylesheet> 或 <xsl:transform> 元素。
xmlns:query="http://www.novell.com/nxsl/java/com.novell.nds.dirxml.driver.XdsQueryProcessor"
在 iManager 或 Designer 中建立新樣式表時,會以名稱空間宣告預先填入。 如需查詢處理器的相關資訊,請參閱類別 XdsQueryProcessor
下列範例使用其中一種查詢處理器 (特別長的文字行已換行,且不以 < 做為開頭):
<!-- Query object name queries NDS for the passed object name --> <xsl:template name="query-object-name"> <xsl:param name="object-name"/> <!-- build an xds query as a result tree fragment --> <xsl:variable name="query"> <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> </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>
這裡是另一個範例。
<?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>