tree schema BUGFIX correct order of predicates

Fixes #2244
diff --git a/src/tree_schema.c b/src/tree_schema.c
index a6cadc5..f7dac07 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -721,9 +721,9 @@
 
                 /* print key predicate */
                 if (buffer) {
-                    len = snprintf(buffer, buflen, "[%s='%%s']%s", key->name, s ? s : "");
+                    len = snprintf(buffer, buflen, "%s[%s='%%s']", s ? s : "", key->name);
                 } else {
-                    len = asprintf(&path, "[%s='%%s']%s", key->name, s ? s : "");
+                    len = asprintf(&path, "%s[%s='%%s']", s ? s : "", key->name);
                 }
                 free(s);