preprocessor.xsl revision 1884
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 ! You can obtain a copy of the license at 1008N/A ! See the License for the specific language governing permissions 1008N/A ! and limitations under the License. 1008N/A ! When distributing Covered Code, include this CDDL HEADER in each 1008N/A ! file and include the License file at 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 ! Portions Copyright 2007 Sun Microsystems, Inc. 1008N/A <
xsl:
output method="xml" indent="yes" />
1008N/A Global parameter: the absolute path of the base directory where 1008N/A XML managed object definitions can be found. 1008N/A <
xsl:
param name="base-dir" select="'.'" />
1008N/A Get an absolute URI from a package, object name, and suffix. 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 Convert the package name to a relative path. 1008N/A <
xsl:
variable name="rpath" select="translate($package, '.', '/')" />
1008N/A Convert the managed object name to a file name. 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 select="concat($base-dir, '/', $rpath, '/', $java-name, $suffix)" />
1008N/A Get the URI of the named package definition. 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 Get the URI of the named managed object definition. 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 Pre-process the current managed object element. 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 select="adm:root-managed-object | adm:managed-object" 1008N/A Pre-process a managed object definition: pull in the managed object's 1008N/A inherited property definitions and relations. 1008N/A <
xsl:
template match="adm:managed-object" mode="pre-process">
1008N/A <
xsl:
message terminate="yes">
1008N/A select="'Managed object definition does not specify managed object name.'" />
1008N/A <
xsl:
if test="not(@package)">
1008N/A <
xsl:
message terminate="yes">
1008N/A select="'Managed object definition does not specify managed object package.'" />
1008N/A <
xsl:
variable name="parent-name" select="@extends" />
1008N/A <
xsl:
variable name="parent-package">
1008N/A The parent package defaults to this managed object's package. 1008N/A <
xsl:
when test="@parent-package">
1008N/A <
xsl:
value-
of select="@parent-package" />
1008N/A <
xsl:
value-
of select="@package" />
1008N/A Get this managed object's hierarchy if there is one. 1008N/A <
xsl:
variable name="_hierarchy">
1008N/A <
xsl:
if test="$parent-name">
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:
if test="not(document($uri)/adm:managed-object)">
1008N/A <
xsl:
message terminate="yes">
1008N/A select="concat('No managed object definition found in ', $uri, '.')" />
1008N/A test="not(document($uri)/adm:managed-object[@name=$parent-name and @package=$parent-package])">
1008N/A <
xsl:
message terminate="yes">
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:
apply-
templates select="document($uri)/adm:managed-object" 1008N/A <
xsl:
variable name="hierarchy" select="exsl:node-set($_hierarchy)" />
1008N/A Now pre-process this managed object. 1008N/A Shallow copy this element and its attributes. 1008N/A <
xsl:
copy-
of select="@*" />
1008N/A Pre-process this managed object's elements. 1548N/A select="adm:TODO|adm:synopsis|adm:description" 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" />
1548N/A Copy all inherited tags plus locally defined tags. 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" />
2648N/A <
xsl:
apply-
templates select="adm:profile" 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" />
1548N/A Add a pre-processor element defining this managed object's uppermost 1548N/A <
xsl:
if test="$parent-name">
1548N/A <
xsl:
element name="adm:profile">
1548N/A <
xsl:
attribute name="name">
1548N/A <
xsl:
value-
of select="'preprocessor'" />
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 name="package">
1008N/A <
xsl:
value-
of select="$parent-package" />
1008N/A Copy all inherited relations. 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 Copy all inherited properties. 1008N/A <
xsl:
variable name="property-overrides" 1008N/A select="adm:property-override" />
1426N/A select="adm:property|adm:property-reference|adm:property-override" 1426N/A <
xsl:
with-
param name="moname" select="@name" />
1426N/A <
xsl:
with-
param name="mopackage" select="@package" />
1008N/A <
xsl:
with-
param name="hierarchy" select="$hierarchy" />
1008N/A Pre-process a managed object definition: pull in the managed object's 1008N/A inherited property definitions and relations. 1008N/A <
xsl:
template match="adm:root-managed-object" mode="pre-process">
1008N/A Now pre-process this root managed object. 1008N/A By definition it has no hierarchy. 1008N/A Shallow copy this element and its attributes. 1008N/A <
xsl:
copy-
of select="@*" />
1008N/A Pre-process this managed object's elements. 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 Pre-process a tag and validate it and by adding a "preprocessor" 1008N/A profile which contains information about where the tag was defined. 1008N/A <
xsl:
template match="adm:tag" mode="pre-process">
1008N/A <
xsl:
param name="mopackage" select="/.." />
1008N/A <
xsl:
param name="moname" select="/.." />
1008N/A <
xsl:
param name="hierarchy" />
1548N/A Make sure that this tag is not duplicated. 1548N/A <
xsl:
variable name="name" select="@name" />
1548N/A <
xsl:
message terminate="yes">
1548N/A select="concat('Tag ', @name, ' is already defined in this managed object')" />
1548N/A Make sure that this tag does not override an existing tag. 1548N/A <
xsl:
message terminate="yes">
1548N/A select="concat('Tag ', @name, ' is already defined in a parent managed object')" />
1548N/A Get the referenced package. 1548N/A <
xsl:
call-
template name="get-managed-object-uri">
1548N/A <
xsl:
with-
param name="package" 1548N/A <
xsl:
with-
param name="name" select="'root'" />
1548N/A <
xsl:
if test="not(document($uri)/adm:root-managed-object)">
1548N/A <
xsl:
message terminate="yes">
1548N/A select="concat('Root managed object definition not found in ', $uri, '.')" />
1548N/A <
xsl:
message terminate="yes">
1548N/A select="concat('Tag "', $name, 1548N/A '" not defined in root managed object definition.')" />
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 Pre-process a property definition by adding a "preprocessor" profile 1548N/A which contains information about where the property was defined. 1548N/A <
xsl:
template match="adm:property" mode="pre-process">
1548N/A <
xsl:
param name="mopackage" select="/.." />
1548N/A <
xsl:
param name="moname" select="/.." />
1548N/A <
xsl:
param name="hierarchy" select="/.." />
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 <
xsl:
variable name="name" select="@name" />
1008N/A <
xsl:
message terminate="yes">
1008N/A select="concat('Property definition ', @name, ' is already defined in this managed object')" />
1008N/A Make sure that this property does not override an existing property. 1008N/A <
xsl:
message terminate="yes">
1008N/A select="concat('Property definition ', @name, ' is already defined in a parent managed object')" />
1008N/A Shallow copy this element and its attributes. 1008N/A <
xsl:
copy-
of select="@*" />
1008N/A Apply templates to subordinate elements (e.g. descriptions). 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 Now append the preprocessor profile. 1008N/A <
xsl:
element name="adm:profile">
1008N/A <
xsl:
attribute name="name">
1008N/A <
xsl:
value-
of select="'preprocessor'" />
1008N/A <
xsl:
element name="admpp:managed-object">
1008N/A <
xsl:
attribute name="name">
1008N/A <
xsl:
value-
of select="$moname" />
1008N/A <
xsl:
attribute name="package">
1008N/A <
xsl:
value-
of select="$mopackage" />
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 <
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 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 <
xsl:
variable name="name" select="@name" />
1008N/A <
xsl:
message terminate="yes">
1008N/A select="concat('Property definition ', @name, ' is already defined in this managed object')" />
1008N/A Make sure that this property does not override an existing property. 1008N/A <
xsl:
message terminate="yes">
1008N/A select="concat('Property reference ', @name, ' is already defined in a parent managed object')" />
1008N/A Determine the package containing the reference property definition. 1008N/A <
xsl:
variable name="package">
1008N/A <
xsl:
value-
of select="@package" />
1008N/A <
xsl:
value-
of select="$mopackage" />
1008N/A Get the referenced package. 1008N/A <
xsl:
call-
template name="get-package-uri">
1008N/A <
xsl:
with-
param name="package" select="$package" />
1008N/A <
xsl:
if test="not(document($uri)/adm:package)">
1008N/A <
xsl:
message terminate="yes">
1008N/A select="concat('No package definition found in ', $uri, '.')" />
1008N/A <
xsl:
if test="not(document($uri)/adm:package[@name=$package])">
1008N/A <
xsl:
message terminate="yes">
1008N/A select="concat('Package definition found in ', $uri, ' but it did not define package ', $package, '.')" />
1008N/A test="not(document($uri)/adm:package[@name=$package]/adm:property[@name=$name])">
1008N/A <
xsl:
message terminate="yes">
1008N/A select="concat('Referenced property definition "', $name, 1008N/A '" not found in package definition "', $package, 1008N/A Copy the referenced property definition taking care to override 1008N/A the default behavior and admin action if required. 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:
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:
when test="adm:requires-admin-action">
1008N/A <
xsl:
apply-
templates select="adm:requires-admin-action" 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:
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:
when test="adm:default-behavior">
1008N/A <
xsl:
apply-
templates select="adm:default-behavior" 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:
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:
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 Now append the preprocessor profile. 1008N/A <
xsl:
element name="adm:profile">
1008N/A <
xsl:
attribute name="name">
1008N/A <
xsl:
value-
of select="'preprocessor'" />
1008N/A <
xsl:
element name="admpp:managed-object">
1008N/A <
xsl:
attribute name="name">
1008N/A <
xsl:
value-
of select="$moname" />
1008N/A <
xsl:
attribute name="package">
1008N/A <
xsl:
value-
of select="$mopackage" />
2345N/A <
xsl:
element name="admpp:package">
1008N/A <
xsl:
attribute name="name">
1008N/A <
xsl:
value-
of select="$package" />
2345N/A Pre-process a property override pulling in the inherited property 1008N/A definition and by adding a "preprocessor" profile which contains 1008N/A information about where the property was redefined. 1008N/A <
xsl:
template match="adm:property-override" mode="pre-process">
1008N/A <
xsl:
param name="mopackage" select="/.." />
1008N/A <
xsl:
param name="moname" select="/.." />
1008N/A <
xsl:
param name="hierarchy" />
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 <
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 select="concat('Property override ', @name, ' is already overridden in this managed object')" />
1426N/A Make sure that this property overrides an existing property. 1426N/A <
xsl:
message terminate="yes">
1426N/A select="concat('Cannot find inherited property ', @name, ' for property override')" />
1426N/A Copy the inherited property definition taking care to override 1426N/A the default behavior and admin action if required. 1426N/A <
xsl:
variable name="property" 1426N/A <
xsl:
element name="adm:property">
1426N/A <
xsl:
copy-
of select="$property/@*" />
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" />
2868N/A <
xsl:
when test="adm:requires-admin-action">
2868N/A <
xsl:
apply-
templates select="adm:requires-admin-action" 2868N/A <
xsl:
with-
param name="mopackage" select="$mopackage" />
2868N/A <
xsl:
with-
param name="moname" select="$moname" />
2868N/A <
xsl:
with-
param name="hierarchy" select="$hierarchy" />
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:
when test="adm:default-behavior">
1426N/A <
xsl:
apply-
templates select="adm:default-behavior" 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:
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:
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 Now append the preprocessor profile. 1426N/A <
xsl:
element name="adm:profile">
1426N/A <
xsl:
attribute name="name">
1426N/A <
xsl:
value-
of select="'preprocessor'" />
1426N/A <
xsl:
element name="admpp:managed-object">
1426N/A <
xsl:
attribute name="name">
1426N/A <
xsl:
value-
of select="$moname" />
1426N/A <
xsl:
attribute name="package">
1426N/A <
xsl:
value-
of select="$mopackage" />
1426N/A Pre-process a relation, merging information from the referenced 1426N/A managed object where required, and by adding a "preprocessor" profile 1426N/A which contains information about where the relation was defined. 2345N/A <
xsl:
template match="adm:relation" mode="pre-process">
1426N/A <
xsl:
param name="mopackage" select="/.." />
1426N/A <
xsl:
param name="moname" select="/.." />
1426N/A <
xsl:
param name="hierarchy" select="/.." />
1426N/A Determine the name of the relation. 1426N/A <
xsl:
variable name="name" select="@name" />
2345N/A Make sure that this relation does not override an existing relation. 2345N/A <
xsl:
message terminate="yes">
2345N/A select="concat('Relation ', $name, ' is already defined in a parent managed object.')" />
2345N/A Make sure that this relation is not already defined in this managed object. 1426N/A <
xsl:
if test="/adm:relation[@name=$name][2]">
1426N/A <
xsl:
message terminate="yes">
1426N/A select="concat('Relation ', $name, ' is already defined in this managed object.')" />
1008N/A Now get the referenced managed object. 1008N/A <
xsl:
variable name="mname">
1008N/A <
xsl:
when test="not(@managed-object-name)">
1008N/A <
xsl:
value-
of select="$name" />
1008N/A <
xsl:
value-
of select="@managed-object-name" />
1008N/A <
xsl:
variable name="mpackage">
1008N/A <
xsl:
when test="not(@managed-object-package)">
1008N/A <
xsl:
value-
of select="$mopackage" />
1008N/A <
xsl:
value-
of select="@managed-object-package" />
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:
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 select="concat('Managed object definition "', $mname, '" not found in ', $uri, '.')" />
1008N/A <
xsl:
copy-
of select="@*" />
1008N/A Add missing attribute managed-object-name if it is not provided. 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 Add missing attribute managed-object-package if it is not provided. 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:
copy-
of select="adm:TODO" />
1008N/A Copy synopsis element from referenced managed object if it is undefined. 1008N/A <
xsl:
when test="adm:synopsis">
1008N/A <
xsl:
apply-
templates select="adm:synopsis" 1008N/A <
xsl:
with-
param name="managed-object" 1008N/A select="$managed-object" />
1008N/A <
xsl:
with-
param name="managed-object" 1008N/A select="$managed-object" />
1008N/A Copy description element from referenced managed object if it is undefined. 1008N/A <
xsl:
when test="adm:description">
1008N/A <
xsl:
apply-
templates select="adm:description" 1008N/A <
xsl:
with-
param name="managed-object" 1008N/A select="$managed-object" />
1008N/A <
xsl:
with-
param name="managed-object" 1008N/A select="$managed-object" />
1008N/A select="*[not(self::adm:TODO|self::adm:synopsis|self::adm:description)]" 1008N/A <
xsl:
with-
param name="managed-object" select="$managed-object" />
1008N/A Now append the preprocessor profile. 1008N/A <
xsl:
element name="adm:profile">
1008N/A <
xsl:
attribute name="name">
1008N/A <
xsl:
value-
of select="'preprocessor'" />
1008N/A <
xsl:
element name="admpp:managed-object">
1008N/A <
xsl:
attribute name="name">
1008N/A <
xsl:
value-
of select="$moname" />
1008N/A <
xsl:
attribute name="package">
1008N/A <
xsl:
value-
of select="$mopackage" />
1008N/A Default template for merging relations. 1008N/A <
xsl:
template match="*|comment()" mode="merge-relation">
1008N/A <
xsl:
param name="managed-object" select="/.." />
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 Merge a one-to-many relation. 1008N/A <
xsl:
template match="adm:one-to-many" mode="merge-relation">
1008N/A <
xsl:
param name="managed-object" select="/.." />
2345N/A Make sure that if this relation uses a naming property that the 1008N/A naming property exists, is single-valued, mandatory, and read-only. 1008N/A <
xsl:
if test="@naming-property">
1008N/A <
xsl:
variable name="naming-property-name" 1008N/A select="@naming-property" />
1008N/A FIXME: this does not cope with the situation where the property 1008N/A is inherited, referenced, or overridden. 1008N/A <
xsl:
variable name="naming-property" 1008N/A <
xsl:
if test="not($naming-property)">
1008N/A <
xsl:
message terminate="yes">
1008N/A select="concat('Relation ', ../@name, 1008N/A ' references an unknown naming property ', 1008N/A $naming-property-name, ' in ', 1008N/A $managed-object/@name, '.')" />
1008N/A <
xsl:
if test="not($naming-property/@read-only='true')">
1008N/A <
xsl:
message terminate="yes">
2989N/A select="concat('Relation ', ../@name, 2989N/A ' references the naming property ', 2989N/A $naming-property-name, ' in ', 2989N/A $managed-object/@name, ' which is not read-only. ', 2989N/A 'Naming properties must be read-only.')" />
2989N/A <
xsl:
if test="not($naming-property/@mandatory='true')">
2989N/A <
xsl:
message terminate="yes">
2989N/A select="concat('Relation ', ../@name, 2989N/A ' references the naming property ', 2989N/A $naming-property-name, ' in ', 2989N/A $managed-object/@name, ' which is not mandatory. ', 2989N/A 'Naming properties must be mandatory.')" />
2989N/A <
xsl:
if test="$naming-property/@multi-valued='true'">
2989N/A <
xsl:
message terminate="yes">
2989N/A select="concat('Relation ', ../@name, 2989N/A ' references the naming property ', 2989N/A $naming-property-name, ' in ', 2989N/A $managed-object/@name, ' which is multi-valued. ', 2989N/A 'Naming properties must be single-valued.')" />
1008N/A <
xsl:
copy-
of select="@*" />
1884N/A Add missing plural name attribute if not present. 1884N/A <
xsl:
if test="not(@plural-name)">
1884N/A <
xsl:
attribute name="plural-name">
1884N/A <
xsl:
value-
of select="$managed-object/@plural-name" />
1884N/A <
xsl:
apply-
templates mode="merge-relation">
1884N/A <
xsl:
with-
param name="managed-object" select="$managed-object" />
1884N/A Process a rich-description element in a relation. 1884N/A <
xsl:
template match="adm:synopsis|adm:description" 1884N/A <
xsl:
param name="managed-object" select="/.." />
1884N/A <
xsl:
copy-
of select="@*" />
1884N/A <
xsl:
apply-
templates mode="rich-description">
1884N/A <
xsl:
with-
param name="ufn">
1884N/A <
xsl:
call-
template name="name-to-ufn">
1884N/A <
xsl:
with-
param name="value" select="$managed-object/@name" />
1884N/A <
xsl:
with-
param name="ufpn">
1884N/A <
xsl:
call-
template name="name-to-ufn">
1884N/A <
xsl:
with-
param name="value" 1884N/A select="$managed-object/@plural-name" />
1884N/A Process a rich-description element. 1884N/A match="adm:synopsis|adm:description|adm:unit-description" 1884N/A <
xsl:
copy-
of select="@*" />
1884N/A <
xsl:
apply-
templates mode="rich-description">
1884N/A <
xsl:
with-
param name="ufn" select="$this-ufn" />
1884N/A <
xsl:
with-
param name="ufpn" select="$this-ufpn" />
1008N/A Process a relative inherited default behavior 1008N/A <
xsl:
template match="adm:relative" 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 <
xsl:
copy-
of select="@*" />
1008N/A Add missing attribute managed-object-package if it is not provided. 1008N/A <
xsl:
if test="not(@managed-object-package)">
1008N/A <
xsl:
attribute name="managed-object-package">
1008N/A <
xsl:
value-
of select="$mopackage" />
1008N/A Apply templates to subordinate elements. 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 Process a user-friendly-name element. 1008N/A <
xsl:
template match="adm:user-friendly-name" 1008N/A <
xsl:
param name="ufn" select="/.." />
1008N/A <
xsl:
value-
of select="$ufn" />
1008N/A Process a user-friendly-plural-name element. 1008N/A <
xsl:
template match="adm:user-friendly-plural-name" 1008N/A <
xsl:
param name="ufpn" select="/.." />
1008N/A <
xsl:
value-
of select="$ufpn" />
1008N/A Process a product-name element. 1008N/A <
xsl:
template match="adm:product-name" mode="rich-description">
1008N/A <
xsl:
value-
of select="$product-name" />
1008N/A Default template for rich descriptions. 1008N/A <
xsl:
template match="*|comment()" mode="rich-description">
1008N/A <
xsl:
param name="ufn" select="/.." />
1418N/A <
xsl:
param name="ufpn" select="/.." />
1418N/A <
xsl:
copy-
of select="@*" />
1418N/A <
xsl:
apply-
templates mode="rich-description">
1418N/A <
xsl:
with-
param name="ufn" select="$ufn" />
1418N/A <
xsl:
with-
param name="ufpn" select="$ufpn" />
1418N/A Default template for pre-processing. 1418N/A <
xsl:
template match="*|comment()" mode="pre-process">
1418N/A <
xsl:
param name="mopackage" select="/.." />
1418N/A <
xsl:
param name="moname" select="/.." />
1418N/A <
xsl:
param name="hierarchy" />
1418N/A <
xsl:
copy-
of select="@*" />
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 Useful variables relating to the current managed object. 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 <
xsl:
variable name="product-name" select="'OpenDS Directory Server'" />
1008N/A <
xsl:
variable name="this-name">
1008N/A <
xsl:
when test="/adm:managed-object">
1008N/A <
xsl:
value-
of select="/adm:managed-object/@name" />
1008N/A Must be the root configuration. 1008N/A <
xsl:
value-
of select="'root'" />
1008N/A <
xsl:
variable name="this-plural-name">
1008N/A <
xsl:
when test="/adm:managed-object">
1008N/A <
xsl:
value-
of select="/adm:managed-object/@plural-name" />
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 <
xsl:
value-
of select="'roots'" />
1008N/A <
xsl:
variable name="this-ufn">
1008N/A <
xsl:
call-
template name="name-to-ufn">
1008N/A <
xsl:
with-
param name="value" select="$this-name" />
1008N/A <
xsl:
variable name="this-ufpn">
1008N/A <
xsl:
call-
template name="name-to-ufn">
1008N/A <
xsl:
with-
param name="value" select="$this-plural-name" />
1008N/A <
xsl:
variable name="_this">
1008N/A <
xsl:
call-
template name="pre-process-managed-object" />
1008N/A <
xsl:
variable name="_this_tmp" select="exsl:node-set($_this)" />
1008N/A <
xsl:
variable name="this-is-abstract" 1008N/A select="boolean(string($this/@abstract) = '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:
when test="not($this-is-root)">
1008N/A <
xsl:
value-
of select="$this/@package" />
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:
variable name="_top-name" 1008N/A select="$this/adm:profile[@name='preprocessor']/admpp:parent-managed-object[last()]/@name" />
1008N/A <
xsl:
variable name="_top-length" select="string-length($_top-name)" />
1008N/A <
xsl:
variable name="_this-length" select="string-length($this-name)" />
1008N/A <
xsl:
variable name="_diff" select="$_this-length - $_top-length" />
1008N/A <
xsl:
variable name="_start" 1008N/A select="substring($this-name, 1, $_diff - 1)" />
1008N/A <
xsl:
variable name="_middle" 1008N/A select="substring($this-name, $_diff, 1)" />
1008N/A select="substring($this-name, $_diff + 1, $_top-length)" />
1008N/A <
xsl:
variable name="this-short-name">
1008N/A <
xsl:
when test="$this-is-root">
1008N/A <
xsl:
value-
of select="''" />
1008N/A <
xsl:
when test="not($_top-name)">
1008N/A <
xsl:
value-
of select="''" />
1008N/A <
xsl:
if test="$_middle != '-' or $_end != $_top-name">
1008N/A <
xsl:
message terminate="yes">
2195N/A select="concat('The managed object ', $this-name, ' should end with ', $_top-name)" />
2195N/A <
xsl:
value-
of select="$_start" />
2195N/A <
xsl:
variable name="this-short-java-class">
2195N/A <
xsl:
call-
template name="name-to-java">
2195N/A <
xsl:
with-
param name="value" select="$this-short-name" />
2195N/A Useful variables relating to the parent managed object. 2195N/A <
xsl:
variable name="parent-name" select="$this/@extends" />
2195N/A <
xsl:
variable name="parent-package">
2195N/A <
xsl:
when test="$this/@parent-package">
2195N/A <
xsl:
value-
of select="$this/@parent-package" />
2195N/A <
xsl:
value-
of select="$this-package" />
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 Useful variables relating to managed object's relations. 2872N/A <
xsl:
variable name="this-local-relations" 2872N/A select="$this/adm:relation[adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]]" />
2872N/A <
xsl:
variable name="this-inherited-relations" 1008N/A select="$this/adm:relation[adm:profile[@name='preprocessor']/admpp:managed-object[not(@name=$this-name and @package=$this-package)]]" />
1008N/A <
xsl:
variable name="this-all-relations" select="$this/adm:relation" />
1008N/A Useful variables relating to managed object's properties. 1008N/A <
xsl:
variable name="this-local-properties" 1008N/A select="$this/adm:property[adm:profile[@name='preprocessor']/admpp:managed-object[@name=$this-name and @package=$this-package]]" />
1008N/A <
xsl:
variable name="this-inherited-properties" 1008N/A select="$this/adm:property[adm:profile[@name='preprocessor']/admpp:managed-object[not(@name=$this-name and @package=$this-package)]]" />
1008N/A <
xsl:
variable name="this-all-properties" select="$this/adm:property" />
1008N/A <
xsl:
copy-
of select="$this" />