- e--; p = &res[0]; i=0;
- sprintf (p, "^"); p++;
- while (e >= 0) {
- /* !!! res size is not checked !!! */
- sprintf (p, "%s/",stack[e]);
- p += strlen(stack[e]) + 1;
- e--;
+ res_p = res = nmem_malloc(data1_nmem_get(dh), res_size + 10);
+
+ if (stack[e-1][0] == '@') /* path/@attr spec (leaf is attribute) */
+ strcpy(res_p, "/");
+ else
+ strcpy(res_p, "[^@]*/"); /* path .. (index all cdata below it) */
+ res_p = res_p + strlen(res_p);
+ while (--e >= 0) {
+ sprintf(res_p, "%s/", stack[e]);
+ res_p += strlen(stack[e]) + 1;
+ }
+ if (!abs)
+ {
+ sprintf(res_p, ".*");
+ res_p += 2;