Fixed template substitution to work in attributes

This commit is contained in:
Olof hagsand 2024-12-03 11:14:44 +01:00
parent 462b18e0d0
commit 379644a570

View file

@ -2419,12 +2419,21 @@ xml_template_apply(cxobj *x,
{ {
int retval = -1; int retval = -1;
cvec *cvv = (cvec *)arg; cvec *cvv = (cvec *)arg;
cxobj *xb; cxobj *xb = NULL;
char *b; char *b;
cbuf *cb = NULL; cbuf *cb = NULL;
if ((xb = xml_body_get(x)) != NULL && switch (xml_type(x)){
(b = xml_value(xb)) != NULL){ case CX_ELMNT:
xb = xml_body_get(x);
break;
case CX_ATTR:
xb = x;
break;
default:
break;
}
if (xb && (b = xml_value(xb)) != NULL){
if ((cb = cbuf_new()) == NULL){ if ((cb = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new"); clixon_err(OE_UNIX, errno, "cbuf_new");
goto done; goto done;