From edcbfaf2c58bd160fd677bcdbe0725f93c1b0728 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 18 Aug 2011 17:34:52 +0000
Subject: [PATCH] Fix OPENDJ-265: Remove XSLT component naming constraint in admin framework

---
 opendj-sdk/opends/resource/admin/metaMO.xsl       |   20 +++++++++++++++-----
 opendj-sdk/opends/resource/admin/preprocessor.xsl |   16 ++++++++++------
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/opendj-sdk/opends/resource/admin/metaMO.xsl b/opendj-sdk/opends/resource/admin/metaMO.xsl
index 6b7a6f2..a8b6fb1 100644
--- a/opendj-sdk/opends/resource/admin/metaMO.xsl
+++ b/opendj-sdk/opends/resource/admin/metaMO.xsl
@@ -23,6 +23,7 @@
   !
   !
   !      Copyright 2007-2010 Sun Microsystems, Inc.
+  !      Portions copyright 2011 ForgeRock AS.
   ! -->
 <xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
   xmlns:admpp="http://www.opends.org/admin-preprocessor"
@@ -1519,20 +1520,29 @@
   <xsl:template name="generate-change-listener-help">
     <xsl:param name="top-name" select="/.." />
     <xsl:param name="name" select="/.." />
+    
+    <xsl:variable name="_top-length" select="string-length($top-name)" />
+    <xsl:variable name="_length" select="string-length($name)" />
+    <xsl:variable name="_diff"   select="$_length - $_top-length" />
+    <xsl:variable name="_start"  select="substring($name, 1, $_diff - 1)" />
+    <xsl:variable name="_middle" select="substring($name, $_diff, 1)" />
+    <xsl:variable name="_end" 
+      select="substring($name, $_diff + 1, $_top-length)" />
+    
     <xsl:variable name="short-name">
       <xsl:choose>
         <xsl:when test="not($top-name) or $top-name = $name">
           <xsl:value-of select="''" />
         </xsl:when>
+        <xsl:when test="$_middle != '-' or $_end != $_top-name">
+          <xsl:value-of select="$name" />
+        </xsl:when>
         <xsl:otherwise>
-          <xsl:variable name="top-length"
-            select="string-length($top-name)" />
-          <xsl:variable name="length" select="string-length($name)" />
-          <xsl:variable name="diff" select="$length - $top-length" />
-          <xsl:value-of select="substring($name, 1, $diff - 1)" />
+          <xsl:value-of select="$_start" />
         </xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
+    
     <xsl:variable name="java-class">
       <xsl:call-template name="name-to-java">
         <xsl:with-param name="value" select="$name" />
diff --git a/opendj-sdk/opends/resource/admin/preprocessor.xsl b/opendj-sdk/opends/resource/admin/preprocessor.xsl
index 9222d7e..f488b97 100644
--- a/opendj-sdk/opends/resource/admin/preprocessor.xsl
+++ b/opendj-sdk/opends/resource/admin/preprocessor.xsl
@@ -22,6 +22,7 @@
   !
   !
   !      Copyright 2008-2010 Sun Microsystems, Inc.
+  !      Portions copyright 2011 ForgeRock AS.
   ! -->
 <xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin"
   xmlns:admpp="http://www.opends.org/admin-preprocessor"
@@ -1194,13 +1195,16 @@
       <xsl:when test="not($_top-name)">
         <xsl:value-of select="''" />
       </xsl:when>
+      <xsl:when test="$_middle != '-' or $_end != $_top-name">
+        <!--
+        <xsl:message terminate="no">
+          <xsl:value-of
+            select="concat('The managed object ', $this-name, ' should end with ', $_top-name)" />
+        </xsl:message>
+        -->
+        <xsl:value-of select="$this-name" />
+      </xsl:when>
       <xsl:otherwise>
-        <xsl:if test="$_middle != '-' or $_end != $_top-name">
-          <xsl:message terminate="yes">
-            <xsl:value-of
-              select="concat('The managed object ', $this-name, ' should end with ', $_top-name)" />
-          </xsl:message>
-        </xsl:if>
         <xsl:value-of select="$_start" />
       </xsl:otherwise>
     </xsl:choose>

--
Gitblit v1.10.0