data tree CHANGE remove implicit presence containers

Seems they cause more problems that they solve.
Consequently, there will be exceptions to RFC
7950 conformance. If a NP container has must
or when that evaluate to false, they will not
be present in the data tree nor for XPath
evaluation.
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index a0cb0eb..462bfb2 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -2514,31 +2514,8 @@
     LY_ERR ret = LY_SUCCESS;
 
     if (cont_p->presence) {
-        /* explicit presence */
-        cont->flags |= LYS_PRESENCE | LYS_SET_PRESENCE;
-    } else if (cont_p->musts) {
-        /* container with a must condition */
-        LOGWRN(ctx->ctx, "Container \"%s\" changed to presence because it has a meaning from its \"must\" condition.",
-                cont_p->name);
+        /* presence container */
         cont->flags |= LYS_PRESENCE;
-    } else if (cont_p->when) {
-        /* container with a when condition */
-        LOGWRN(ctx->ctx, "Container \"%s\" changed to presence because it has a meaning from its \"when\" condition.",
-                cont_p->name);
-        cont->flags |= LYS_PRESENCE;
-    } else if (cont_p->parent) {
-        if (cont_p->parent->nodetype == LYS_CHOICE) {
-            /* container is an implicit case, so its existence decides the existence of the whole case */
-            LOGWRN(ctx->ctx, "Container \"%s\" changed to presence because it has a meaning as a case of choice \"%s\".",
-                    cont_p->name, cont_p->parent->name);
-            cont->flags |= LYS_PRESENCE;
-        } else if ((cont_p->parent->nodetype == LYS_CASE) &&
-                (((struct lysp_node_case *)cont_p->parent)->child == pnode) && !cont_p->next) {
-            /* container is the only node in a case, so its existence decides the existence of the whole case */
-            LOGWRN(ctx->ctx, "Container \"%s\" changed to presence because it has a meaning as a case of choice \"%s\".",
-                    cont_p->name, cont_p->parent->name);
-            cont->flags |= LYS_PRESENCE;
-        }
     }
 
     /* more cases when the container has meaning but is kept NP for convenience:
diff --git a/src/tree_data.c b/src/tree_data.c
index 6a1235c..16436fe 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -1656,9 +1656,10 @@
                 node->flags = LYD_DEFAULT | (lysc_node_when(node->schema) ? LYD_WHEN_TRUE : 0);
                 lyd_insert_node(parent, first, node);
 
-                /* cannot be a NP container with when */
-                assert(!lysc_node_when(iter));
-
+                if (lysc_node_when(iter) && node_when) {
+                    /* remember to resolve when */
+                    LY_CHECK_RET(ly_set_add(node_when, node, 1, NULL));
+                }
                 if (diff) {
                     /* add into diff */
                     LY_CHECK_RET(lyd_val_diff_add(node, LYD_DIFF_OP_CREATE, diff));
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 47307c9..7e25fb7 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -838,7 +838,6 @@
  *      10 LYS_SET_DFLT     | | |x|x| | |x| | | | | | | |
  *         LYS_IS_ENUM      | | | | | | | | | | | | |x| |
  *         LYS_KEYLESS      | | | | |x| | | | | | | | | |
- *         LYS_SET_PRESENCE |x| | | | | | | | | | | | | |
  *                          +-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *      11 LYS_SET_UNITS    | | |x|x| | | | | | | | | | |
  *                          +-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -912,7 +911,6 @@
                                           with default statement mandatory. In case the default leaf value is taken from type, it is thrown
                                           away when it is refined to be mandatory node. Similarly it is used for deviations to distinguish
                                           between own default or the default values taken from the type. */
-#define LYS_SET_PRESENCE 0x0200      /**< flag to know if container presence property was set explicitly */
 #define LYS_SET_UNITS    0x0400      /**< flag to know if the leaf's/leaflist's units are their own (flag set) or it is taken from the type. */
 #define LYS_SET_CONFIG   0x0800      /**< flag to know if the config property was set explicitly (flag set) or it is inherited. */