TRINIDAD-1274
Prevent super class definitions of properties, facets and attributes from being considered when they have definitions in the child class XML build files. This is the JSF 1.1 version (1.2 already committed)
diff --git a/maven-faces-plugin/src/main/resources/org/apache/myfaces/trinidadbuild/plugin/faces/resources/transform.xsl b/maven-faces-plugin/src/main/resources/org/apache/myfaces/trinidadbuild/plugin/faces/resources/transform.xsl
index 77347e2..7ed80f9 100644
--- a/maven-faces-plugin/src/main/resources/org/apache/myfaces/trinidadbuild/plugin/faces/resources/transform.xsl
+++ b/maven-faces-plugin/src/main/resources/org/apache/myfaces/trinidadbuild/plugin/faces/resources/transform.xsl
@@ -16,13 +16,13 @@
     KIND, either express or implied.  See the License for the

     specific language governing permissions and limitations

     under the License.

-	   

+

 -->

 <xsl:stylesheet xmlns="http://java.sun.com/JSF/Configuration"

-                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

                 xmlns:xs="http://www.w3.org/2001/XMLSchema"

                 xmlns:javaee="http://java.sun.com/xml/ns/javaee"

-                xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin" 

+                xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin"

                 exclude-result-prefixes="xsl xs javaee mfp"

                 version="1.0" >

 

@@ -43,22 +43,22 @@
   <!ELEMENT attribute-values (#PCDATA)>

   <!ATTLIST component-metadata component-type CDATA #IMPLIED>]]></xsl:variable>

   <xsl:variable name="doctype-end"><![CDATA[]>]]></xsl:variable>

-  

+

   <xsl:variable name="entity-elem-start"><![CDATA[

   <!ELEMENT ]]></xsl:variable>

   <xsl:variable name="entity-elem-end"><![CDATA[ (#PCDATA)>]]></xsl:variable>

 

-  <xsl:key name="component-type" 

-           match="javaee:component" 

+  <xsl:key name="component-type"

+           match="javaee:component"

            use="javaee:component-type/text()" />

 

-  <xsl:key name="render-kit-id" 

-           match="javaee:render-kit" 

+  <xsl:key name="render-kit-id"

+           match="javaee:render-kit"

            use="javaee:render-kit-id/text()" />

 

-  <!-- switch off default text processing -->  

+  <!-- switch off default text processing -->

   <xsl:template match="//text()" />

-    

+

   <xsl:template

     match="mfp:property-metadata|mfp:facet-metadata|mfp:component-metadata"

     mode="generate-entities"

@@ -67,14 +67,14 @@
       select="./*[namespace-uri() != 'http://java.sun.com/xml/ns/javaee']"

       mode="generate-entities-metadata"/>

   </xsl:template>

-  

+

   <xsl:template

     match="javaee:property-extension|javaee:facet-extension|javaee:component-extension"

     mode="generate-entities"

     priority="1">

     <xsl:apply-templates

       select="./*[

-        namespace-uri() != 'http://java.sun.com/xml/ns/javaee' 

+        namespace-uri() != 'http://java.sun.com/xml/ns/javaee'

         and (

           namespace-uri() != 'http://myfaces.apache.org/maven-faces-plugin'

           or (

@@ -85,11 +85,11 @@
         )]"

       mode="generate-entities-metadata"/>

   </xsl:template>

-  

+

   <xsl:template match="@*|node()" mode="generate-entities" priority="-1">

     <!-- Block matches outside this mode -->

   </xsl:template>

-  

+

   <!-- do not create elements with J2EE names -->

   <xsl:template match="*[local-name() = 'faces-config'

     or local-name() = 'application'

@@ -173,7 +173,7 @@
     or local-name() = 'variable-resolver']"

     mode="generate-entities-metadata"

     priority="2" />

-  

+

   <xsl:template match="*"

     mode="generate-entities-metadata"

     priority="1">

@@ -188,7 +188,7 @@
         select="concat($entity-elem-start, local-name(), $entity-elem-end)" />

     </xsl:if>

   </xsl:template>

-  

+

   <xsl:template match="@*|node()" mode="generate-entities-metadata" priority="-1">

     <!-- Block matches outside this mode -->

   </xsl:template>

@@ -233,48 +233,111 @@
        for a component and all supertypes -->

   <xsl:template name="apply-property-templates" >

     <xsl:param name="component" />

+    <xsl:param name="skip"></xsl:param>

     <xsl:variable name="componentSupertype"

                   select="$component/javaee:component-extension/mfp:component-supertype/text()" />

     <xsl:if test="$componentSupertype" >

       <xsl:call-template name="apply-property-templates" >

-        <xsl:with-param name="component" 

+        <xsl:with-param name="component"

                         select="key('component-type', $componentSupertype)" />

+        <!-- "Recursively" build a skip set of nodes. This is created as a

+          string and appended to for every super class applied. The square

+          brackets are used for a "whole-world" type of functionality. -->

+        <xsl:with-param name="skip"><xsl:value-of select="$skip"

+          /><xsl:for-each

+            select="$component/javaee:property/javaee:property-name"

+            >[<xsl:value-of select="normalize-space(text())" />]</xsl:for-each>

+        </xsl:with-param>

       </xsl:call-template>

     </xsl:if>

-    <xsl:apply-templates select="$component/javaee:property" />

+    <!-- uncomment this code to help debug the skip functionality: -->

+    <!--xsl:comment>

+      Skip is: <xsl:value-of select="$skip" />

+    </xsl:comment-->

+    <xsl:for-each select="$component/javaee:property">

+      <xsl:variable name="searchFor">[<xsl:value-of

+        select="normalize-space(javaee:property-name/text())"/>]</xsl:variable>

+      <!-- Do not include this element if it is overridden in the sub-type -->

+      <xsl:if

+        test="not(contains($skip, $searchFor))">

+        <xsl:apply-templates select="." />

+      </xsl:if>

+    </xsl:for-each>

   </xsl:template>

-  

+

   <!-- this templates applies javaee:attribute templates

        for a component and all supertypes -->

   <xsl:template name="apply-attribute-templates" >

     <xsl:param name="component" />

+    <xsl:param name="skip"></xsl:param>

     <xsl:variable name="componentSupertype"

                   select="$component/javaee:component-extension/mfp:component-supertype/text()" />

     <xsl:if test="$componentSupertype" >

       <xsl:call-template name="apply-attribute-templates" >

         <xsl:with-param name="component"

                         select="key('component-type', $componentSupertype)" />

+        <!-- "Recursively" build a skip set of nodes. This is created as a

+          string and appended to for every super class applied. The square

+          brackets are used for a "whole-world" type of functionality. -->

+        <xsl:with-param name="skip"><xsl:value-of select="$skip"

+          /><xsl:for-each

+            select="$component/javaee:attribute/javaee:attribute-name"

+            >[<xsl:value-of select="normalize-space(text())" />]</xsl:for-each>

+        </xsl:with-param>

       </xsl:call-template>

     </xsl:if>

-    <xsl:apply-templates select="$component/javaee:attribute" />

+    <!-- uncomment this code to help debug the skip functionality: -->

+    <!--xsl:comment>

+      Skip is: <xsl:value-of select="$skip" />

+    </xsl:comment-->

+    <xsl:for-each select="$component/javaee:attribute">

+      <xsl:variable name="searchFor">[<xsl:value-of

+        select="normalize-space(javaee:attribute-name/text())"/>]</xsl:variable>

+      <!-- Do not include this element if it is overridden in the sub-type -->

+      <xsl:if

+        test="not(contains($skip, $searchFor))">

+        <xsl:apply-templates select="." />

+      </xsl:if>

+    </xsl:for-each>

   </xsl:template>

-  

+

   <!-- this templates applies javaee:facet templates

        for a component and all supertypes -->

   <xsl:template name="apply-facet-templates" >

     <xsl:param name="component" />

+    <xsl:param name="skip"></xsl:param>

     <xsl:variable name="componentSupertype"

                   select="$component/javaee:component-extension/mfp:component-supertype/text()" />

     <xsl:if test="$componentSupertype" >

       <xsl:call-template name="apply-facet-templates" >

         <xsl:with-param name="component"

                         select="key('component-type', $componentSupertype)" />

+        <!-- "Recursively" build a skip set of nodes. This is created as a

+          string and appended to for every super class applied. The square

+          brackets are used for a "whole-world" type of functionality. -->

+        <xsl:with-param name="skip"><xsl:value-of select="$skip"

+          /><xsl:for-each

+            select="$component/javaee:facet/javaee:facet-name"

+            >[<xsl:value-of select="normalize-space(text())" />]</xsl:for-each>

+        </xsl:with-param>

       </xsl:call-template>

     </xsl:if>

-    <xsl:apply-templates select="$component/javaee:facet" />

+    <!-- uncomment this code to help debug the skip functionality: -->

+    <!--xsl:comment>

+      Skip is: <xsl:value-of select="$skip" />

+    </xsl:comment-->

+    <xsl:for-each select="$component/javaee:facet">

+      <xsl:variable name="searchFor">[<xsl:value-of

+        select="normalize-space(javaee:facet-name/text())"/>]</xsl:variable>

+      <!-- Do not include this element if it is overridden in the sub-type -->

+      <xsl:if

+        test="not(contains($skip, $searchFor))">

+        <xsl:apply-templates select="." />

+      </xsl:if>

+    </xsl:for-each>

   </xsl:template>

-  

-  <xsl:template match="//javaee:component[javaee:component-extension/mfp:component-supertype]" 

+

+  <xsl:template match="//javaee:component[javaee:component-extension/mfp:component-supertype]"

                 priority="1" >

     <xsl:element name="component" >

       <xsl:apply-templates select="javaee:description" />

@@ -444,7 +507,7 @@
             <xsl:apply-templates select="mfp:facet-metadata/*[

               namespace-uri() != 'http://java.sun.com/xml/ns/javaee']" />

             <!-- Add non-metadata children under the metadata -->

-            <xsl:apply-templates select="*[namespace-uri() != 'http://java.sun.com/xml/ns/javaee' 

+            <xsl:apply-templates select="*[namespace-uri() != 'http://java.sun.com/xml/ns/javaee'

               and (

                 namespace-uri() != 'http://myfaces.apache.org/maven-faces-plugin'

                 or name() != 'mfp:facet-metadata'

@@ -455,7 +518,7 @@
     </xsl:if>

   </xsl:template>

 

-  

+

   <xsl:template match="//javaee:component/javaee:attribute[1]" priority="1" >

     <xsl:comment><xsl:value-of select="parent::node()/javaee:component-type/text()" /> attributes</xsl:comment>

     <xsl:element name="attribute" >

@@ -530,7 +593,7 @@
       </xsl:choose>

     </xsl:element>

   </xsl:template>

-  

+

   <xsl:template match="//javaee:property-extension">

     <!-- Make sure not empty -->

     <xsl:if test="*">

@@ -542,7 +605,7 @@
             <xsl:apply-templates select="mfp:property-metadata/*[

               namespace-uri() != 'http://java.sun.com/xml/ns/javaee']" />

             <!-- Add non-metadata children under the metadata -->

-            <xsl:apply-templates select="*[namespace-uri() != 'http://java.sun.com/xml/ns/javaee' 

+            <xsl:apply-templates select="*[namespace-uri() != 'http://java.sun.com/xml/ns/javaee'

               and (

                 namespace-uri() != 'http://myfaces.apache.org/maven-faces-plugin'

                 or name() != 'mfp:property-metadata'

@@ -564,7 +627,7 @@
       <xsl:apply-templates/>

     </xsl:element>

   </xsl:template>

-  

+

   <xsl:template match="//javaee:component-extension[mfp:component-family]" priority="2" >

     <xsl:element name="component-extension" >

       <xsl:apply-templates/>

@@ -957,7 +1020,7 @@
     <xsl:copy>

       <xsl:apply-templates select="@*|node()"/>

       <xsl:value-of select="text()"/>

-    </xsl:copy> 

+    </xsl:copy>

   </xsl:template>

 

   <xsl:template match="mfp:component-metadata/*[

@@ -966,7 +1029,7 @@
     <xsl:copy>

       <xsl:apply-templates select="@*|node()"/>

       <xsl:value-of select="text()"/>

-    </xsl:copy> 

+    </xsl:copy>

   </xsl:template>

 

   <xsl:template match="//*[

@@ -978,7 +1041,7 @@
     </xsl:element>

   </xsl:template>

 

-  <!-- Blacklisted mfp: that should not be copied over into the faces-config.xml: --> 

+  <!-- Blacklisted mfp: that should not be copied over into the faces-config.xml: -->

   <xsl:template match="//mfp:alternate-class" />

   <xsl:template match="//mfp:author" />

   <xsl:template match="//mfp:component-metadata/mfp:group" />