MYFACES-4304 - dynamic ui:include doesn't always work
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
index 1204790..148d0a8 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
@@ -248,17 +248,18 @@
             if (!src.isLiteral())
             {
                 fcc.endComponentUniqueIdSection();
+                
+                if (fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS()
+                        && !fcc.isRefreshingTransientBuild())
+                {
+                    //Mark the parent component to be saved and restored fully.
+                    ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
+                }
+                if (fcc.isDynamicComponentSection())
+                {
+                    ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);
+                }
             }
         }
-        if (!src.isLiteral() && fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS()
-                && !fcc.isRefreshingTransientBuild())
-        {
-            //Mark the parent component to be saved and restored fully.
-            ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
-        }
-        if (!src.isLiteral() && fcc.isDynamicComponentSection())
-        {
-            ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);
-        }
     }
 }
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java
index 50fb094..5e9fed5 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java
@@ -234,17 +234,18 @@
             if (!src.isLiteral())
             {
                 fcc.endComponentUniqueIdSection();
+                
+                if (fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS() &&
+                    !fcc.isRefreshingTransientBuild())
+                {
+                    //Mark the parent component to be saved and restored fully.
+                    ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
+                }
+                if (fcc.isDynamicComponentSection())
+                {
+                    ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);
+                }
             }
         }
-        if (!src.isLiteral() && fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS() &&
-            !fcc.isRefreshingTransientBuild())
-        {
-            //Mark the parent component to be saved and restored fully.
-            ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
-        }
-        if (!src.isLiteral() && fcc.isDynamicComponentSection())
-        {
-            ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);
-        }
     }
 }