1008N/A<!-- CDDL HEADER START
1008N/A !
1008N/A ! The contents of this file are subject to the terms of the
1008N/A ! Common Development and Distribution License, Version 1.0 only
1008N/A ! (the "License"). You may not use this file except in compliance
1008N/A ! with the License.
1008N/A !
1008N/A ! You can obtain a copy of the license at
1008N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
1008N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
1008N/A ! See the License for the specific language governing permissions
1008N/A ! and limitations under the License.
1008N/A !
1008N/A ! When distributing Covered Code, include this CDDL HEADER in each
1008N/A ! file and include the License file at
1008N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1008N/A ! add the following below this CDDL HEADER, with the fields enclosed
1008N/A ! by brackets "[]" replaced with your own identifying information:
1008N/A ! Portions Copyright [yyyy] [name of copyright owner]
1008N/A !
1008N/A ! CDDL HEADER END
1008N/A !
1008N/A !
5062N/A ! Copyright 2008-2010 Sun Microsystems, Inc.
5487N/A ! Portions copyright 2011 ForgeRock AS.
1008N/A ! -->
1008N/A<xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
1008N/A xmlns:admpp="http://www.opends.org/admin-preprocessor"
1008N/A xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5062N/A xmlns:exsl="http://exslt.org/common"
5062N/A xmlns:file="xalan://java.io.File">
1008N/A <xsl:import href="java-utilities.xsl" />
1008N/A <xsl:output method="xml" indent="yes" />
1008N/A <!--
1008N/A Global parameter: the absolute path of the base directory where
1008N/A XML managed object definitions can be found.
1008N/A -->
1008N/A <xsl:param name="base-dir" select="'.'" />
1008N/A <!--
1008N/A Get an absolute URI from a package, object name, and suffix.
1008N/A -->
1008N/A <xsl:template name="get-uri">
1008N/A <xsl:param name="package" select="/.." />
1008N/A <xsl:param name="name" select="/.." />
1008N/A <xsl:param name="suffix" select="'.xml'" />
1008N/A <!--
1008N/A Convert the package name to a relative path.
1008N/A -->
1008N/A <xsl:variable name="rpath" select="translate($package, '.', '/')" />
1008N/A <!--
1008N/A Convert the managed object name to a file name.
1008N/A -->
1008N/A <xsl:variable name="java-name">
1008N/A <xsl:call-template name="name-to-java">
1008N/A <xsl:with-param name="value" select="$name" />
1008N/A </xsl:call-template>
1008N/A </xsl:variable>
1008N/A <!--
1008N/A Get the absolute path.
1008N/A -->
5062N/A <xsl:variable name="base-file" select="file:new($base-dir)" />
5062N/A <xsl:variable name="base-dir-uri" select="file:toURI($base-file)" />
1008N/A <xsl:value-of
5062N/A select="concat($base-dir-uri, '/', $rpath, '/', $java-name, $suffix)" />
1008N/A </xsl:template>
1008N/A <!--
1008N/A Get the URI of the named package definition.
1008N/A -->
1008N/A <xsl:template name="get-package-uri">
1008N/A <xsl:param name="package" select="/.." />
1008N/A <xsl:call-template name="get-uri">
1008N/A <xsl:with-param name="package" select="$package" />
1008N/A <xsl:with-param name="name" select="'package'" />
1008N/A </xsl:call-template>
1008N/A </xsl:template>
1008N/A <!--
1008N/A Get the URI of the named managed object definition.
1008N/A -->
1008N/A <xsl:template name="get-managed-object-uri">
1008N/A <xsl:param name="package" select="/.." />
1008N/A <xsl:param name="name" select="/.." />
1008N/A <xsl:call-template name="get-uri">
1008N/A <xsl:with-param name="package" select="$package" />
1008N/A <xsl:with-param name="name"
1008N/A select="concat($name, '-configuration')" />
1008N/A </xsl:call-template>
1008N/A </xsl:template>
1008N/A <!--
1008N/A Pre-process the current managed object element.
1008N/A -->
1008N/A <xsl:template name="pre-process-managed-object">
1008N/A <xsl:if test="not(adm:root-managed-object | adm:managed-object)">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of select="'No managed object definition found.'" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <xsl:apply-templates
1008N/A select="adm:root-managed-object | adm:managed-object"
1008N/A mode="pre-process" />
1008N/A </xsl:template>
1008N/A <!--
1008N/A Pre-process a managed object definition: pull in the managed object's
1008N/A inherited property definitions and relations.
1008N/A -->
1008N/A <xsl:template match="adm:managed-object" mode="pre-process">
1008N/A <xsl:if test="not(@name)">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="'Managed object definition does not specify managed object name.'" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <xsl:if test="not(@package)">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="'Managed object definition does not specify managed object package.'" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <xsl:variable name="parent-name" select="@extends" />
1008N/A <xsl:variable name="parent-package">
1008N/A <!--
1008N/A The parent package defaults to this managed object's package.
1008N/A -->
1008N/A <xsl:choose>
1008N/A <xsl:when test="@parent-package">
1008N/A <xsl:value-of select="@parent-package" />
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <xsl:value-of select="@package" />
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <!--
1008N/A Get this managed object's hierarchy if there is one.
1008N/A -->
1008N/A <xsl:variable name="_hierarchy">
1008N/A <xsl:if test="$parent-name">
1008N/A <xsl:variable name="uri">
1008N/A <xsl:call-template name="get-managed-object-uri">
1008N/A <xsl:with-param name="package" select="$parent-package" />
1008N/A <xsl:with-param name="name" select="$parent-name" />
1008N/A </xsl:call-template>
1008N/A </xsl:variable>
1008N/A <xsl:if test="not(document($uri)/adm:managed-object)">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('No managed object definition found in ', $uri, '.')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <xsl:if
1008N/A test="not(document($uri)/adm:managed-object[@name=$parent-name and @package=$parent-package])">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('Managed object definition found in ', $uri, ' but it did not define a managed object ', $parent-name, ' in package ', $parent-package, '.')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <xsl:apply-templates select="document($uri)/adm:managed-object"
1008N/A mode="pre-process" />
1008N/A </xsl:if>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="hierarchy" select="exsl:node-set($_hierarchy)" />
1008N/A <!--
1008N/A Now pre-process this managed object.
1008N/A -->
1008N/A <xsl:copy>
1008N/A <!--
1008N/A Shallow copy this element and its attributes.
1008N/A -->
1008N/A <xsl:copy-of select="@*" />
1008N/A <!--
1008N/A Pre-process this managed object's elements.
1008N/A -->
1008N/A <xsl:apply-templates
1548N/A select="adm:TODO|adm:synopsis|adm:description"
1008N/A mode="pre-process">
1008N/A <xsl:with-param name="moname" select="@name" />
1008N/A <xsl:with-param name="mopackage" select="@package" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1548N/A <!--
1548N/A Copy all inherited tags plus locally defined tags.
1548N/A -->
1548N/A <xsl:copy-of select="$hierarchy/adm:managed-object/adm:tag" />
1548N/A <xsl:apply-templates select="adm:tag" mode="pre-process">
1548N/A <xsl:with-param name="moname" select="@name" />
1548N/A <xsl:with-param name="mopackage" select="@package" />
1548N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1548N/A </xsl:apply-templates>
1548N/A <!--
2648N/A Copy constraint elements.
2648N/A -->
2648N/A <xsl:apply-templates select="adm:constraint" mode="pre-process">
2648N/A <xsl:with-param name="moname" select="@name" />
2648N/A <xsl:with-param name="mopackage" select="@package" />
2648N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
2648N/A </xsl:apply-templates>
2648N/A <!--
1548N/A Copy profile elements.
1548N/A -->
1548N/A <xsl:apply-templates select="adm:profile" mode="pre-process">
1548N/A <xsl:with-param name="moname" select="@name" />
1548N/A <xsl:with-param name="mopackage" select="@package" />
1548N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1548N/A </xsl:apply-templates>
1008N/A <!--
1008N/A Add a pre-processor element defining this managed object's uppermost
1008N/A definition.
1008N/A -->
1008N/A <xsl:if test="$parent-name">
1008N/A <xsl:element name="adm:profile">
1008N/A <xsl:attribute name="name">
1008N/A <xsl:value-of select="'preprocessor'" />
1008N/A </xsl:attribute>
1008N/A <xsl:element name="admpp:parent-managed-object">
1008N/A <xsl:attribute name="name">
1008N/A <xsl:value-of select="$parent-name" />
1008N/A </xsl:attribute>
1008N/A <xsl:attribute name="package">
1008N/A <xsl:value-of select="$parent-package" />
1008N/A </xsl:attribute>
1008N/A </xsl:element>
1008N/A <xsl:copy-of
1008N/A select="$hierarchy/adm:managed-object/adm:profile[@name='preprocessor']/admpp:parent-managed-object" />
1008N/A </xsl:element>
1008N/A </xsl:if>
1008N/A <!--
1008N/A Copy all inherited relations.
1008N/A -->
1008N/A <xsl:copy-of select="$hierarchy/adm:managed-object/adm:relation" />
1008N/A <!--
1008N/A Copy all local relations.
1008N/A -->
1008N/A <xsl:apply-templates select="adm:relation" mode="pre-process">
1008N/A <xsl:with-param name="moname" select="@name" />
1008N/A <xsl:with-param name="mopackage" select="@package" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1008N/A <!--
1008N/A Copy all inherited properties.
1008N/A -->
1426N/A <xsl:variable name="property-overrides"
1426N/A select="adm:property-override" />
1426N/A <xsl:copy-of
1426N/A select="$hierarchy/adm:managed-object/adm:property[not(@name=$property-overrides/@name)]" />
1008N/A <!--
1008N/A Copy all local properties.
1008N/A -->
1426N/A <xsl:apply-templates
1426N/A select="adm:property|adm:property-reference|adm:property-override"
1008N/A mode="pre-process">
1008N/A <xsl:with-param name="moname" select="@name" />
1008N/A <xsl:with-param name="mopackage" select="@package" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:copy>
1008N/A </xsl:template>
1008N/A <!--
1008N/A Pre-process a managed object definition: pull in the managed object's
1008N/A inherited property definitions and relations.
1008N/A -->
1008N/A <xsl:template match="adm:root-managed-object" mode="pre-process">
1008N/A <!--
1008N/A Now pre-process this root managed object.
1008N/A By definition it has no hierarchy.
1008N/A -->
1008N/A <xsl:copy>
1008N/A <!--
1008N/A Shallow copy this element and its attributes.
1008N/A -->
1008N/A <xsl:copy-of select="@*" />
1008N/A <!--
1008N/A Pre-process this managed object's elements.
1008N/A -->
1008N/A <xsl:apply-templates mode="pre-process">
1008N/A <xsl:with-param name="moname" select="'root'" />
1008N/A <xsl:with-param name="mopackage"
1008N/A select="'org.opends.server.admin.std'" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:copy>
1008N/A </xsl:template>
1008N/A <!--
1548N/A Pre-process a tag and validate it and by adding a "preprocessor"
1548N/A profile which contains information about where the tag was defined.
1548N/A -->
1548N/A <xsl:template match="adm:tag" mode="pre-process">
1548N/A <xsl:param name="mopackage" select="/.." />
1548N/A <xsl:param name="moname" select="/.." />
1548N/A <xsl:param name="hierarchy" />
1548N/A <!--
1548N/A Make sure that this tag is not duplicated.
1548N/A -->
1548N/A <xsl:variable name="name" select="@name" />
1548N/A <xsl:if test="/adm:tag[@name=$name][2]">
1548N/A <xsl:message terminate="yes">
1548N/A <xsl:value-of
1548N/A select="concat('Tag ', @name, ' is already defined in this managed object')" />
1548N/A </xsl:message>
1548N/A </xsl:if>
1548N/A <!--
1548N/A Make sure that this tag does not override an existing tag.
1548N/A -->
1548N/A <xsl:if test="$hierarchy/adm:managed-object/adm:tag[@name=$name]">
1548N/A <xsl:message terminate="yes">
1548N/A <xsl:value-of
1548N/A select="concat('Tag ', @name, ' is already defined in a parent managed object')" />
1548N/A </xsl:message>
1548N/A </xsl:if>
1548N/A <!--
1548N/A Get the referenced package.
1548N/A -->
1548N/A <xsl:variable name="uri">
1548N/A <xsl:call-template name="get-managed-object-uri">
1548N/A <xsl:with-param name="package"
1548N/A select="'org.opends.server.admin.std'" />
1548N/A <xsl:with-param name="name" select="'root'" />
1548N/A </xsl:call-template>
1548N/A </xsl:variable>
1548N/A <xsl:if test="not(document($uri)/adm:root-managed-object)">
1548N/A <xsl:message terminate="yes">
1548N/A <xsl:value-of
1548N/A select="concat('Root managed object definition not found in ', $uri, '.')" />
1548N/A </xsl:message>
1548N/A </xsl:if>
1548N/A <xsl:if
1548N/A test="not(document($uri)/adm:root-managed-object/adm:tag-definition[@name=$name])">
1548N/A <xsl:message terminate="yes">
1548N/A <xsl:value-of
1548N/A select="concat('Tag &quot;', $name,
1548N/A '&quot; not defined in root managed object definition.')" />
1548N/A </xsl:message>
1548N/A </xsl:if>
1548N/A <!--
1548N/A Copy the tag.
1548N/A -->
1548N/A <xsl:element name="adm:tag">
1548N/A <xsl:copy-of select="@*" />
1548N/A <xsl:apply-templates mode="pre-process">
1548N/A <xsl:with-param name="moname" select="$moname" />
1548N/A <xsl:with-param name="mopackage" select="$mopackage" />
1548N/A </xsl:apply-templates>
1548N/A </xsl:element>
1548N/A </xsl:template>
1548N/A <!--
1008N/A Pre-process a property definition by adding a "preprocessor" profile
1008N/A which contains information about where the property was defined.
1008N/A -->
1008N/A <xsl:template match="adm:property" mode="pre-process">
1008N/A <xsl:param name="mopackage" select="/.." />
1008N/A <xsl:param name="moname" select="/.." />
1008N/A <xsl:param name="hierarchy" select="/.." />
1008N/A <!--
1008N/A Make sure that this property does not have the same name as another
1008N/A property or reference in this managed object.
1008N/A -->
1008N/A <xsl:variable name="name" select="@name" />
1008N/A <xsl:if
1008N/A test="/adm:property[@name=$name][2] |
1008N/A /adm:property-reference[@name=$name]">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('Property definition ', @name, ' is already defined in this managed object')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <!--
1008N/A Make sure that this property does not override an existing property.
1008N/A -->
1008N/A <xsl:if
1008N/A test="$hierarchy/adm:managed-object/adm:property[@name=$name]">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('Property definition ', @name, ' is already defined in a parent managed object')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <xsl:copy>
1008N/A <!--
1008N/A Shallow copy this element and its attributes.
1008N/A -->
1008N/A <xsl:copy-of select="@*" />
1008N/A <!--
1008N/A Apply templates to subordinate elements (e.g. descriptions).
1008N/A -->
1008N/A <xsl:apply-templates mode="pre-process">
1008N/A <xsl:with-param name="mopackage" select="$mopackage" />
1008N/A <xsl:with-param name="moname" select="$moname" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1008N/A <!--
1008N/A Now append the preprocessor profile.
1008N/A -->
1008N/A <xsl:element name="adm:profile">
1008N/A <xsl:attribute name="name">
1008N/A <xsl:value-of select="'preprocessor'" />
1008N/A </xsl:attribute>
2345N/A <xsl:element name="admpp:last-defined-in">
1008N/A <xsl:attribute name="name">
1008N/A <xsl:value-of select="$moname" />
1008N/A </xsl:attribute>
1008N/A <xsl:attribute name="package">
1008N/A <xsl:value-of select="$mopackage" />
1008N/A </xsl:attribute>
1008N/A </xsl:element>
1008N/A </xsl:element>
1008N/A </xsl:copy>
1008N/A </xsl:template>
1008N/A <!--
1008N/A Pre-process a property reference pulling in the referenced property
1008N/A definition and by adding a "preprocessor" profile which contains
1008N/A information about where the property was defined.
1008N/A -->
1008N/A <xsl:template match="adm:property-reference" mode="pre-process">
1008N/A <xsl:param name="mopackage" select="/.." />
1008N/A <xsl:param name="moname" select="/.." />
1008N/A <xsl:param name="hierarchy" />
1008N/A <!--
1008N/A Make sure that this property reference does not have the same name as another
1008N/A property or reference in this managed object.
1008N/A -->
1008N/A <xsl:variable name="name" select="@name" />
1008N/A <xsl:if
1008N/A test="/adm:property[@name=$name] |
1008N/A /adm:property-reference[@name=$name][2]">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('Property definition ', @name, ' is already defined in this managed object')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <!--
1008N/A Make sure that this property does not override an existing property.
1008N/A -->
1008N/A <xsl:if
1008N/A test="$hierarchy/adm:managed-object/adm:property[@name=$name]">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('Property reference ', @name, ' is already defined in a parent managed object')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <!--
1008N/A Determine the package containing the reference property definition.
1008N/A -->
1008N/A <xsl:variable name="package">
1008N/A <xsl:choose>
1008N/A <xsl:when test="@package">
1008N/A <xsl:value-of select="@package" />
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <xsl:value-of select="$mopackage" />
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <!--
1008N/A Get the referenced package.
1008N/A -->
1008N/A <xsl:variable name="uri">
1008N/A <xsl:call-template name="get-package-uri">
1008N/A <xsl:with-param name="package" select="$package" />
1008N/A </xsl:call-template>
1008N/A </xsl:variable>
1008N/A <xsl:if test="not(document($uri)/adm:package)">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('No package definition found in ', $uri, '.')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <xsl:if test="not(document($uri)/adm:package[@name=$package])">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('Package definition found in ', $uri, ' but it did not define package ', $package, '.')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <xsl:if
1008N/A test="not(document($uri)/adm:package[@name=$package]/adm:property[@name=$name])">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('Referenced property definition &quot;', $name,
1008N/A '&quot; not found in package definition &quot;', $package,
1008N/A '&quot;.')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <!--
1008N/A Copy the referenced property definition taking care to override
1008N/A the default behavior and admin action if required.
1008N/A -->
1008N/A <xsl:variable name="property"
1008N/A select="document($uri)/adm:package[@name=$package]/adm:property[@name=$name]" />
1008N/A <xsl:element name="adm:property">
1008N/A <xsl:copy-of select="$property/@*" />
1008N/A <xsl:apply-templates
1008N/A select="$property/adm:TODO | $property/adm:synopsis | $property/adm:description"
1008N/A mode="pre-process">
1008N/A <xsl:with-param name="mopackage" select="$mopackage" />
1008N/A <xsl:with-param name="moname" select="$moname" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1008N/A <xsl:choose>
1008N/A <xsl:when test="adm:requires-admin-action">
1008N/A <xsl:apply-templates select="adm:requires-admin-action"
1008N/A mode="pre-process">
1008N/A <xsl:with-param name="mopackage" select="$mopackage" />
1008N/A <xsl:with-param name="moname" select="$moname" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <xsl:apply-templates
1008N/A select="$property/adm:requires-admin-action"
1008N/A mode="pre-process">
1008N/A <xsl:with-param name="mopackage" select="$mopackage" />
1008N/A <xsl:with-param name="moname" select="$moname" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A <xsl:choose>
1008N/A <xsl:when test="adm:default-behavior">
1008N/A <xsl:apply-templates select="adm:default-behavior"
1008N/A mode="pre-process">
1008N/A <xsl:with-param name="mopackage" select="$mopackage" />
1008N/A <xsl:with-param name="moname" select="$moname" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <xsl:apply-templates select="$property/adm:default-behavior"
1008N/A mode="pre-process">
1008N/A <xsl:with-param name="mopackage" select="$mopackage" />
1008N/A <xsl:with-param name="moname" select="$moname" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A <xsl:apply-templates
1008N/A select="$property/adm:syntax | $property/adm:profile"
1008N/A mode="pre-process">
1008N/A <xsl:with-param name="mopackage" select="$mopackage" />
1008N/A <xsl:with-param name="moname" select="$moname" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1008N/A <!--
1008N/A Now append the preprocessor profile.
1008N/A -->
1008N/A <xsl:element name="adm:profile">
1008N/A <xsl:attribute name="name">
1008N/A <xsl:value-of select="'preprocessor'" />
1008N/A </xsl:attribute>
2345N/A <xsl:element name="admpp:last-defined-in">
1008N/A <xsl:attribute name="name">
1008N/A <xsl:value-of select="$moname" />
1008N/A </xsl:attribute>
1008N/A <xsl:attribute name="package">
1008N/A <xsl:value-of select="$mopackage" />
1008N/A </xsl:attribute>
1008N/A </xsl:element>
2345N/A <xsl:element name="admpp:first-defined-in">
2345N/A <xsl:attribute name="package">
1008N/A <xsl:value-of select="$package" />
1008N/A </xsl:attribute>
1008N/A </xsl:element>
1008N/A </xsl:element>
1008N/A </xsl:element>
1008N/A </xsl:template>
1008N/A <!--
1426N/A Pre-process a property override pulling in the inherited property
1426N/A definition and by adding a "preprocessor" profile which contains
1426N/A information about where the property was redefined.
1426N/A -->
1426N/A <xsl:template match="adm:property-override" mode="pre-process">
1426N/A <xsl:param name="mopackage" select="/.." />
1426N/A <xsl:param name="moname" select="/.." />
1426N/A <xsl:param name="hierarchy" />
1426N/A <!--
1426N/A Make sure that this property override does not have the same name as another
1426N/A property override in this managed object.
1426N/A -->
1426N/A <xsl:variable name="name" select="@name" />
1426N/A <xsl:if test="/adm:property-override[@name=$name][2]">
1426N/A <xsl:message terminate="yes">
1426N/A <xsl:value-of
1426N/A select="concat('Property override ', @name, ' is already overridden in this managed object')" />
1426N/A </xsl:message>
1426N/A </xsl:if>
1426N/A <!--
1426N/A Make sure that this property overrides an existing property.
1426N/A -->
1426N/A <xsl:if
1426N/A test="not($hierarchy/adm:managed-object/adm:property[@name=$name])">
1426N/A <xsl:message terminate="yes">
1426N/A <xsl:value-of
1426N/A select="concat('Cannot find inherited property ', @name, ' for property override')" />
1426N/A </xsl:message>
1426N/A </xsl:if>
1426N/A <!--
1426N/A Copy the inherited property definition taking care to override
1426N/A the default behavior and admin action if required.
1426N/A -->
1426N/A <xsl:variable name="property"
1426N/A select="$hierarchy/adm:managed-object/adm:property[@name=$name]" />
1426N/A <xsl:element name="adm:property">
2868N/A <xsl:copy-of select="$property/@*[local-name() != 'advanced']" />
2868N/A <xsl:choose>
2868N/A <xsl:when test="@advanced">
2868N/A <xsl:copy-of select="@advanced" />
2868N/A </xsl:when>
2868N/A <xsl:otherwise>
2868N/A <xsl:copy-of select="$property/@advanced" />
2868N/A </xsl:otherwise>
2868N/A </xsl:choose>
1426N/A <xsl:apply-templates
1426N/A select="$property/adm:TODO | $property/adm:synopsis | $property/adm:description"
1426N/A mode="pre-process">
1426N/A <xsl:with-param name="mopackage" select="$mopackage" />
1426N/A <xsl:with-param name="moname" select="$moname" />
1426N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1426N/A </xsl:apply-templates>
1426N/A <xsl:choose>
1426N/A <xsl:when test="adm:requires-admin-action">
1426N/A <xsl:apply-templates select="adm:requires-admin-action"
1426N/A mode="pre-process">
1426N/A <xsl:with-param name="mopackage" select="$mopackage" />
1426N/A <xsl:with-param name="moname" select="$moname" />
1426N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1426N/A </xsl:apply-templates>
1426N/A </xsl:when>
1426N/A <xsl:otherwise>
1426N/A <xsl:apply-templates
1426N/A select="$property/adm:requires-admin-action"
1426N/A mode="pre-process">
1426N/A <xsl:with-param name="mopackage" select="$mopackage" />
1426N/A <xsl:with-param name="moname" select="$moname" />
1426N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1426N/A </xsl:apply-templates>
1426N/A </xsl:otherwise>
1426N/A </xsl:choose>
1426N/A <xsl:choose>
1426N/A <xsl:when test="adm:default-behavior">
1426N/A <xsl:apply-templates select="adm:default-behavior"
1426N/A mode="pre-process">
1426N/A <xsl:with-param name="mopackage" select="$mopackage" />
1426N/A <xsl:with-param name="moname" select="$moname" />
1426N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1426N/A </xsl:apply-templates>
1426N/A </xsl:when>
1426N/A <xsl:otherwise>
1426N/A <xsl:apply-templates select="$property/adm:default-behavior"
1426N/A mode="pre-process">
1426N/A <xsl:with-param name="mopackage" select="$mopackage" />
1426N/A <xsl:with-param name="moname" select="$moname" />
1426N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1426N/A </xsl:apply-templates>
1426N/A </xsl:otherwise>
1426N/A </xsl:choose>
1426N/A <xsl:apply-templates
1426N/A select="$property/adm:syntax | $property/adm:profile[@name!='preprocessor']"
1426N/A mode="pre-process">
1426N/A <xsl:with-param name="mopackage" select="$mopackage" />
1426N/A <xsl:with-param name="moname" select="$moname" />
1426N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1426N/A </xsl:apply-templates>
1426N/A <!--
1426N/A Now append the preprocessor profile.
1426N/A -->
1426N/A <xsl:element name="adm:profile">
1426N/A <xsl:attribute name="name">
1426N/A <xsl:value-of select="'preprocessor'" />
1426N/A </xsl:attribute>
2345N/A <xsl:element name="admpp:last-defined-in">
1426N/A <xsl:attribute name="name">
1426N/A <xsl:value-of select="$moname" />
1426N/A </xsl:attribute>
1426N/A <xsl:attribute name="package">
1426N/A <xsl:value-of select="$mopackage" />
1426N/A </xsl:attribute>
1426N/A </xsl:element>
2345N/A <xsl:choose>
2345N/A <xsl:when
2345N/A test="$property/adm:profile[@name='preprocessor']/admpp:first-defined-in">
2345N/A <xsl:copy-of
2345N/A select="$property/adm:profile[@name='preprocessor']/admpp:first-defined-in" />
2345N/A </xsl:when>
2345N/A <xsl:otherwise>
2345N/A <xsl:element name="admpp:first-defined-in">
2345N/A <xsl:copy-of
2345N/A select="$property/adm:profile[@name='preprocessor']/admpp:last-defined-in/@*" />
2345N/A </xsl:element>
2345N/A </xsl:otherwise>
2345N/A </xsl:choose>
1426N/A </xsl:element>
1426N/A </xsl:element>
1426N/A </xsl:template>
1426N/A <!--
1008N/A Pre-process a relation, merging information from the referenced
1008N/A managed object where required, and by adding a "preprocessor" profile
1008N/A which contains information about where the relation was defined.
1008N/A -->
1008N/A <xsl:template match="adm:relation" mode="pre-process">
1008N/A <xsl:param name="mopackage" select="/.." />
1008N/A <xsl:param name="moname" select="/.." />
1008N/A <xsl:param name="hierarchy" select="/.." />
1008N/A <!--
1008N/A Determine the name of the relation.
1008N/A -->
1008N/A <xsl:variable name="name" select="@name" />
1008N/A <!--
1008N/A Make sure that this relation does not override an existing relation.
1008N/A -->
1008N/A <xsl:if
1008N/A test="$hierarchy/adm:managed-object/adm:relation[@name=$name]">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('Relation ', $name, ' is already defined in a parent managed object.')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <!--
1008N/A Make sure that this relation is not already defined in this managed object.
1008N/A -->
1008N/A <xsl:if test="/adm:relation[@name=$name][2]">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('Relation ', $name, ' is already defined in this managed object.')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <!--
1008N/A Now get the referenced managed object.
1008N/A -->
1008N/A <xsl:variable name="mname">
1008N/A <xsl:choose>
1008N/A <xsl:when test="not(@managed-object-name)">
1008N/A <xsl:value-of select="$name" />
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <xsl:value-of select="@managed-object-name" />
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="mpackage">
1008N/A <xsl:choose>
1008N/A <xsl:when test="not(@managed-object-package)">
1008N/A <xsl:value-of select="$mopackage" />
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <xsl:value-of select="@managed-object-package" />
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="uri">
1008N/A <xsl:call-template name="get-managed-object-uri">
1008N/A <xsl:with-param name="name" select="$mname" />
1008N/A <xsl:with-param name="package" select="$mpackage" />
1008N/A </xsl:call-template>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="managed-object"
1008N/A select="document($uri)/adm:managed-object[@name=$mname]" />
1008N/A <xsl:if test="not($managed-object)">
1008N/A <xsl:message terminate="yes">
1008N/A <xsl:value-of
1008N/A select="concat('Managed object definition &quot;', $mname, '&quot; not found in ', $uri, '.')" />
1008N/A </xsl:message>
1008N/A </xsl:if>
1008N/A <!--
1008N/A Now merge the relation.
1008N/A -->
1008N/A <xsl:copy>
1008N/A <xsl:copy-of select="@*" />
1008N/A <!--
1008N/A Add missing attribute managed-object-name if it is not provided.
1008N/A -->
1008N/A <xsl:if test="not(@managed-object-name)">
1008N/A <xsl:attribute name="managed-object-name">
1008N/A <xsl:value-of select="$mname" />
1008N/A </xsl:attribute>
1008N/A </xsl:if>
1008N/A <!--
1008N/A Add missing attribute managed-object-package if it is not provided.
1008N/A -->
1008N/A <xsl:if test="not(@managed-object-package)">
1008N/A <xsl:attribute name="managed-object-package">
1008N/A <xsl:value-of select="$mpackage" />
1008N/A </xsl:attribute>
1008N/A </xsl:if>
1008N/A <!--
1008N/A Copy TODO element.
1008N/A -->
1008N/A <xsl:copy-of select="adm:TODO" />
1008N/A <!--
1008N/A Copy synopsis element from referenced managed object if it is undefined.
1008N/A -->
1008N/A <xsl:choose>
1008N/A <xsl:when test="adm:synopsis">
1008N/A <xsl:apply-templates select="adm:synopsis"
1008N/A mode="merge-relation">
1008N/A <xsl:with-param name="managed-object"
1008N/A select="$managed-object" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <xsl:apply-templates select="$managed-object/adm:synopsis"
1008N/A mode="merge-relation">
1008N/A <xsl:with-param name="managed-object"
1008N/A select="$managed-object" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A <!--
1008N/A Copy description element from referenced managed object if it is undefined.
1008N/A -->
1008N/A <xsl:choose>
1008N/A <xsl:when test="adm:description">
1008N/A <xsl:apply-templates select="adm:description"
1008N/A mode="merge-relation">
1008N/A <xsl:with-param name="managed-object"
1008N/A select="$managed-object" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <xsl:apply-templates select="$managed-object/adm:description"
1008N/A mode="merge-relation">
1008N/A <xsl:with-param name="managed-object"
1008N/A select="$managed-object" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A <!--
1008N/A Merge remaining elements.
1008N/A -->
1008N/A <xsl:apply-templates
1008N/A select="*[not(self::adm:TODO|self::adm:synopsis|self::adm:description)]"
1008N/A mode="merge-relation">
1008N/A <xsl:with-param name="managed-object" select="$managed-object" />
1008N/A </xsl:apply-templates>
1008N/A <!--
1008N/A Now append the preprocessor profile.
1008N/A -->
1008N/A <xsl:element name="adm:profile">
1008N/A <xsl:attribute name="name">
1008N/A <xsl:value-of select="'preprocessor'" />
1008N/A </xsl:attribute>
2345N/A <xsl:element name="admpp:last-defined-in">
1008N/A <xsl:attribute name="name">
1008N/A <xsl:value-of select="$moname" />
1008N/A </xsl:attribute>
1008N/A <xsl:attribute name="package">
1008N/A <xsl:value-of select="$mopackage" />
1008N/A </xsl:attribute>
1008N/A </xsl:element>
1008N/A </xsl:element>
1008N/A </xsl:copy>
1008N/A </xsl:template>
1008N/A <!--
1008N/A Default template for merging relations.
1008N/A -->
1008N/A <xsl:template match="*|comment()" mode="merge-relation">
1008N/A <xsl:param name="managed-object" select="/.." />
1008N/A <xsl:copy>
1008N/A <xsl:copy-of select="@*" />
1008N/A <xsl:apply-templates mode="merge-relation">
1008N/A <xsl:with-param name="managed-object" select="$managed-object" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:copy>
1008N/A </xsl:template>
1008N/A <!--
2989N/A Merge a default managed object.
2989N/A -->
2989N/A <xsl:template match="adm:default-managed-object" mode="merge-relation">
2989N/A <xsl:param name="managed-object" select="/.." />
2989N/A <xsl:copy>
2989N/A <xsl:copy-of select="@*" />
2989N/A <!--
2989N/A Add missing attribute managed-object-name if it is not provided.
2989N/A -->
2989N/A <xsl:if test="not(@managed-object-name)">
2989N/A <xsl:attribute name="managed-object-name">
2989N/A <xsl:value-of select="$managed-object/@name" />
2989N/A </xsl:attribute>
2989N/A </xsl:if>
2989N/A <!--
2989N/A Add missing attribute managed-object-package if it is not provided.
2989N/A -->
2989N/A <xsl:if test="not(@managed-object-package)">
2989N/A <xsl:attribute name="managed-object-package">
2989N/A <xsl:value-of select="$managed-object/@package" />
2989N/A </xsl:attribute>
2989N/A </xsl:if>
2989N/A <xsl:apply-templates mode="merge-relation">
2989N/A <xsl:with-param name="managed-object" select="$managed-object" />
2989N/A </xsl:apply-templates>
2989N/A </xsl:copy>
2989N/A </xsl:template>
2989N/A <!--
1008N/A Merge a one-to-many relation.
1008N/A -->
1008N/A <xsl:template match="adm:one-to-many" mode="merge-relation">
1008N/A <xsl:param name="managed-object" select="/.." />
1884N/A <!--
1884N/A Make sure that if this relation uses a naming property that the
1884N/A naming property exists, is single-valued, mandatory, and read-only.
1884N/A -->
1884N/A <xsl:if test="@naming-property">
1884N/A <xsl:variable name="naming-property-name"
1884N/A select="@naming-property" />
1884N/A <!--
1884N/A FIXME: this does not cope with the situation where the property
1884N/A is inherited, referenced, or overridden.
1884N/A -->
1884N/A <xsl:variable name="naming-property"
1884N/A select="$managed-object/adm:property[@name=$naming-property-name]" />
1884N/A <xsl:if test="not($naming-property)">
1884N/A <xsl:message terminate="yes">
1884N/A <xsl:value-of
1884N/A select="concat('Relation ', ../@name,
1884N/A ' references an unknown naming property ',
1884N/A $naming-property-name, ' in ',
1884N/A $managed-object/@name, '.')" />
1884N/A </xsl:message>
1884N/A </xsl:if>
1884N/A <xsl:if test="not($naming-property/@read-only='true')">
1884N/A <xsl:message terminate="yes">
1884N/A <xsl:value-of
1884N/A select="concat('Relation ', ../@name,
1884N/A ' references the naming property ',
1884N/A $naming-property-name, ' in ',
1884N/A $managed-object/@name, ' which is not read-only. ',
1884N/A 'Naming properties must be read-only.')" />
1884N/A </xsl:message>
1884N/A </xsl:if>
1884N/A <xsl:if test="not($naming-property/@mandatory='true')">
1884N/A <xsl:message terminate="yes">
1884N/A <xsl:value-of
1884N/A select="concat('Relation ', ../@name,
1884N/A ' references the naming property ',
1884N/A $naming-property-name, ' in ',
1884N/A $managed-object/@name, ' which is not mandatory. ',
1884N/A 'Naming properties must be mandatory.')" />
1884N/A </xsl:message>
1884N/A </xsl:if>
1884N/A <xsl:if test="$naming-property/@multi-valued='true'">
1884N/A <xsl:message terminate="yes">
1884N/A <xsl:value-of
1884N/A select="concat('Relation ', ../@name,
1884N/A ' references the naming property ',
1884N/A $naming-property-name, ' in ',
1884N/A $managed-object/@name, ' which is multi-valued. ',
1884N/A 'Naming properties must be single-valued.')" />
1884N/A </xsl:message>
1884N/A </xsl:if>
1884N/A </xsl:if>
1008N/A <xsl:copy>
1008N/A <xsl:copy-of select="@*" />
1008N/A <!--
1008N/A Add missing plural name attribute if not present.
1008N/A -->
1008N/A <xsl:if test="not(@plural-name)">
1008N/A <xsl:attribute name="plural-name">
1008N/A <xsl:value-of select="$managed-object/@plural-name" />
1008N/A </xsl:attribute>
1008N/A </xsl:if>
1008N/A <xsl:apply-templates mode="merge-relation">
1008N/A <xsl:with-param name="managed-object" select="$managed-object" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:copy>
1008N/A </xsl:template>
1008N/A <!--
1008N/A Process a rich-description element in a relation.
1008N/A -->
1008N/A <xsl:template match="adm:synopsis|adm:description"
1008N/A mode="merge-relation">
1008N/A <xsl:param name="managed-object" select="/.." />
1008N/A <xsl:copy>
1008N/A <!--
1008N/A Shallow copy.
1008N/A -->
1008N/A <xsl:copy-of select="@*" />
1008N/A <xsl:apply-templates mode="rich-description">
1008N/A <xsl:with-param name="ufn">
1008N/A <xsl:call-template name="name-to-ufn">
1008N/A <xsl:with-param name="value" select="$managed-object/@name" />
1008N/A </xsl:call-template>
1008N/A </xsl:with-param>
1008N/A <xsl:with-param name="ufpn">
1008N/A <xsl:call-template name="name-to-ufn">
1008N/A <xsl:with-param name="value"
1008N/A select="$managed-object/@plural-name" />
1008N/A </xsl:call-template>
1008N/A </xsl:with-param>
1008N/A </xsl:apply-templates>
1008N/A </xsl:copy>
1008N/A </xsl:template>
1008N/A <!--
1008N/A Process a rich-description element.
1008N/A -->
1008N/A <xsl:template
1008N/A match="adm:synopsis|adm:description|adm:unit-description"
1008N/A mode="pre-process">
1008N/A <xsl:copy>
1008N/A <!--
1008N/A Shallow copy.
1008N/A -->
1008N/A <xsl:copy-of select="@*" />
1008N/A <xsl:apply-templates mode="rich-description">
1008N/A <xsl:with-param name="ufn" select="$this-ufn" />
1008N/A <xsl:with-param name="ufpn" select="$this-ufpn" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:copy>
1008N/A </xsl:template>
1008N/A <!--
1418N/A Process a relative inherited default behavior
1418N/A -->
1418N/A <xsl:template match="adm:relative" mode="pre-process">
1418N/A <xsl:param name="mopackage" select="/.." />
1418N/A <xsl:param name="moname" select="/.." />
1418N/A <xsl:param name="hierarchy" select="/.." />
1418N/A <xsl:copy>
1418N/A <!--
1418N/A Shallow copy.
1418N/A -->
1418N/A <xsl:copy-of select="@*" />
1418N/A <!--
1418N/A Add missing attribute managed-object-package if it is not provided.
1418N/A -->
1418N/A <xsl:if test="not(@managed-object-package)">
1418N/A <xsl:attribute name="managed-object-package">
1418N/A <xsl:value-of select="$mopackage" />
1418N/A </xsl:attribute>
1418N/A </xsl:if>
1418N/A <!--
1418N/A Apply templates to subordinate elements.
1418N/A -->
1418N/A <xsl:apply-templates mode="pre-process">
1418N/A <xsl:with-param name="mopackage" select="$mopackage" />
1418N/A <xsl:with-param name="moname" select="$moname" />
1418N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1418N/A </xsl:apply-templates>
1418N/A </xsl:copy>
1418N/A </xsl:template>
1418N/A <!--
1008N/A Process a user-friendly-name element.
1008N/A -->
1008N/A <xsl:template match="adm:user-friendly-name"
1008N/A mode="rich-description">
1008N/A <xsl:param name="ufn" select="/.." />
1008N/A <xsl:value-of select="$ufn" />
1008N/A </xsl:template>
1008N/A <!--
1008N/A Process a user-friendly-plural-name element.
1008N/A -->
1008N/A <xsl:template match="adm:user-friendly-plural-name"
1008N/A mode="rich-description">
1008N/A <xsl:param name="ufpn" select="/.." />
1008N/A <xsl:value-of select="$ufpn" />
1008N/A </xsl:template>
1008N/A <!--
1008N/A Process a product-name element.
1008N/A -->
1008N/A <xsl:template match="adm:product-name" mode="rich-description">
1008N/A <xsl:value-of select="$product-name" />
1008N/A </xsl:template>
1008N/A <!--
1008N/A Default template for rich descriptions.
1008N/A -->
1008N/A <xsl:template match="*|comment()" mode="rich-description">
1008N/A <xsl:param name="ufn" select="/.." />
1008N/A <xsl:param name="ufpn" select="/.." />
1008N/A <xsl:copy>
1008N/A <xsl:copy-of select="@*" />
1008N/A <xsl:apply-templates mode="rich-description">
1008N/A <xsl:with-param name="ufn" select="$ufn" />
1008N/A <xsl:with-param name="ufpn" select="$ufpn" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:copy>
1008N/A </xsl:template>
1008N/A <!--
1008N/A Default template for pre-processing.
1008N/A -->
1008N/A <xsl:template match="*|comment()" mode="pre-process">
1008N/A <xsl:param name="mopackage" select="/.." />
1008N/A <xsl:param name="moname" select="/.." />
1008N/A <xsl:param name="hierarchy" />
1008N/A <xsl:copy>
1008N/A <xsl:copy-of select="@*" />
1008N/A <xsl:apply-templates mode="pre-process">
1008N/A <xsl:with-param name="mopackage" select="$mopackage" />
1008N/A <xsl:with-param name="moname" select="$moname" />
1008N/A <xsl:with-param name="hierarchy" select="$hierarchy" />
1008N/A </xsl:apply-templates>
1008N/A </xsl:copy>
1008N/A </xsl:template>
1008N/A <!--
1008N/A Useful variables relating to the current managed object.
1008N/A -->
1008N/A <!--
1008N/A Product name.
1008N/A
1008N/A FIXME: should get this from the root configuration but for some
1008N/A reason we get a circular dependency error when constructing
1008N/A the URI in JDK1.6.
1008N/A -->
5422N/A <xsl:variable name="product-name" select="'OpenDJ'" />
1008N/A <xsl:variable name="this-name">
1008N/A <xsl:choose>
1008N/A <xsl:when test="/adm:managed-object">
1008N/A <xsl:value-of select="/adm:managed-object/@name" />
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <!--
1008N/A Must be the root configuration.
1008N/A -->
1008N/A <xsl:value-of select="'root'" />
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="this-plural-name">
1008N/A <xsl:choose>
1008N/A <xsl:when test="/adm:managed-object">
1008N/A <xsl:value-of select="/adm:managed-object/@plural-name" />
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <!--
1008N/A Must be the root configuration - the plural form should never
1008N/A be required as this is a singleton. We'll define it for
1008N/A consistency.
1008N/A -->
1008N/A <xsl:value-of select="'roots'" />
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="this-ufn">
2195N/A <xsl:choose>
2195N/A <xsl:when test="/adm:managed-object/adm:user-friendly-name">
2195N/A <xsl:value-of
2195N/A select="normalize-space(/adm:managed-object/adm:user-friendly-name)" />
2195N/A </xsl:when>
2195N/A <xsl:otherwise>
2195N/A <xsl:call-template name="name-to-ufn">
2195N/A <xsl:with-param name="value" select="$this-name" />
2195N/A </xsl:call-template>
2195N/A </xsl:otherwise>
2195N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="this-ufpn">
2195N/A <xsl:choose>
2195N/A <xsl:when
2195N/A test="/adm:managed-object/adm:user-friendly-plural-name">
2195N/A <xsl:value-of
2195N/A select="normalize-space(/adm:managed-object/adm:user-friendly-plural-name)" />
2195N/A </xsl:when>
2195N/A <xsl:otherwise>
2195N/A <xsl:call-template name="name-to-ufn">
2195N/A <xsl:with-param name="value" select="$this-plural-name" />
2195N/A </xsl:call-template>
2195N/A </xsl:otherwise>
2195N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="_this">
1008N/A <xsl:call-template name="pre-process-managed-object" />
1008N/A </xsl:variable>
1008N/A <xsl:variable name="_this_tmp" select="exsl:node-set($_this)" />
1008N/A <xsl:variable name="this"
1008N/A select="$_this_tmp/adm:managed-object | $_this_tmp/adm:root-managed-object" />
1008N/A <xsl:variable name="this-is-abstract"
1008N/A select="boolean(string($this/@abstract) = 'true')" />
2872N/A <xsl:variable name="this-is-advanced"
2872N/A select="boolean(string($this/@advanced) = 'true')" />
2872N/A <xsl:variable name="this-is-hidden"
2872N/A select="boolean(string($this/@hidden) = 'true')" />
1008N/A <xsl:variable name="this-is-root"
1008N/A select="not(local-name($this) = 'managed-object')" />
1008N/A <xsl:variable name="this-package">
1008N/A <xsl:choose>
1008N/A <xsl:when test="not($this-is-root)">
1008N/A <xsl:value-of select="$this/@package" />
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <xsl:value-of select="'org.opends.server.admin.std'" />
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="this-java-class">
1008N/A <xsl:call-template name="name-to-java">
1008N/A <xsl:with-param name="value" select="$this-name" />
1008N/A </xsl:call-template>
1008N/A </xsl:variable>
1013N/A <xsl:variable name="_top-name"
1013N/A select="$this/adm:profile[@name='preprocessor']/admpp:parent-managed-object[last()]/@name" />
1013N/A <xsl:variable name="_top-length" select="string-length($_top-name)" />
1013N/A <xsl:variable name="_this-length" select="string-length($this-name)" />
1013N/A <xsl:variable name="_diff" select="$_this-length - $_top-length" />
1013N/A <xsl:variable name="_start"
1013N/A select="substring($this-name, 1, $_diff - 1)" />
1013N/A <xsl:variable name="_middle"
1013N/A select="substring($this-name, $_diff, 1)" />
1013N/A <xsl:variable name="_end"
1013N/A select="substring($this-name, $_diff + 1, $_top-length)" />
1008N/A <xsl:variable name="this-short-name">
1008N/A <xsl:choose>
1008N/A <xsl:when test="$this-is-root">
1008N/A <xsl:value-of select="''" />
1008N/A </xsl:when>
1013N/A <xsl:when test="not($_top-name)">
1008N/A <xsl:value-of select="''" />
1008N/A </xsl:when>
5487N/A <xsl:when test="$_middle != '-' or $_end != $_top-name">
5487N/A <!--
5487N/A <xsl:message terminate="no">
5487N/A <xsl:value-of
5487N/A select="concat('The managed object ', $this-name, ' should end with ', $_top-name)" />
5487N/A </xsl:message>
5487N/A -->
5487N/A <xsl:value-of select="$this-name" />
5487N/A </xsl:when>
1008N/A <xsl:otherwise>
1013N/A <xsl:value-of select="$_start" />
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="this-short-java-class">
1008N/A <xsl:call-template name="name-to-java">
1008N/A <xsl:with-param name="value" select="$this-short-name" />
1008N/A </xsl:call-template>
1008N/A </xsl:variable>
1008N/A <!--
1008N/A Useful variables relating to the parent managed object.
1008N/A -->
1008N/A <xsl:variable name="parent-name" select="$this/@extends" />
1008N/A <xsl:variable name="parent-package">
1008N/A <xsl:choose>
1008N/A <xsl:when test="$this/@parent-package">
1008N/A <xsl:value-of select="$this/@parent-package" />
1008N/A </xsl:when>
1008N/A <xsl:otherwise>
1008N/A <xsl:value-of select="$this-package" />
1008N/A </xsl:otherwise>
1008N/A </xsl:choose>
1008N/A </xsl:variable>
1008N/A <xsl:variable name="parent-java-class">
1008N/A <xsl:call-template name="name-to-java">
1008N/A <xsl:with-param name="value" select="$parent-name" />
1008N/A </xsl:call-template>
1008N/A </xsl:variable>
1008N/A <!--
1008N/A Useful variables relating to managed object's relations.
1008N/A -->
1008N/A <xsl:variable name="this-local-relations"
2345N/A select="$this/adm:relation[adm:profile[@name='preprocessor']/admpp:last-defined-in[@name=$this-name and @package=$this-package]]" />
1008N/A <xsl:variable name="this-inherited-relations"
2345N/A select="$this/adm:relation[adm:profile[@name='preprocessor']/admpp:last-defined-in[not(@name=$this-name and @package=$this-package)]]" />
1008N/A <xsl:variable name="this-all-relations" select="$this/adm:relation" />
1008N/A <!--
1008N/A Useful variables relating to managed object's properties.
1008N/A -->
1008N/A <xsl:variable name="this-local-properties"
2345N/A select="$this/adm:property[adm:profile[@name='preprocessor']/admpp:last-defined-in[@name=$this-name and @package=$this-package]]" />
1008N/A <xsl:variable name="this-inherited-properties"
2345N/A select="$this/adm:property[adm:profile[@name='preprocessor']/admpp:last-defined-in[not(@name=$this-name and @package=$this-package)]]" />
1008N/A <xsl:variable name="this-all-properties" select="$this/adm:property" />
1008N/A <!--
1008N/A Default rule for testing.
1008N/A -->
1008N/A <xsl:template match="/">
1008N/A <xsl:copy-of select="$this" />
1008N/A </xsl:template>
1008N/A</xsl:stylesheet>