xsltMessage: : an XSLT processing context : The current node : The node containing the message instruction
Process and xsl:message construct
Definition at line 427 of file xsltutils.c.
Referenced by xsltApplySequenceConstructor(), and xsltRegisterAllElement().
{
xmlGenericErrorFunc error = xsltGenericError;
void *errctx = xsltGenericErrorContext;
xmlChar *prop, *message;
int terminate = 0;
if ((ctxt == NULL) || (inst == NULL))
return;
if (ctxt->error != NULL) {
error = ctxt->error;
errctx = ctxt->errctx;
}
prop = xmlGetNsProp(inst, (const xmlChar *)"terminate", NULL);
if (prop != NULL) {
if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
terminate = 1;
} else if (xmlStrEqual(prop, (const xmlChar *)"no")) {
terminate = 0;
} else {
error(errctx,
"xsl:message : terminate expecting 'yes' or 'no'\n");
ctxt->state = XSLT_STATE_ERROR;
}
xmlFree(prop);
}
message = xsltEvalTemplateString(ctxt, node, inst);
if (message != NULL) {
int len = xmlStrlen(message);
error(errctx, "%s", (const char *)message);
if ((len > 0) && (message[len - 1] != '\n'))
error(errctx, "\n");
xmlFree(message);
}
if (terminate)
ctxt->state = XSLT_STATE_STOPPED;
}