Skip to main content

xsltTransformError

Function xsltTransformError 

Source
pub fn xsltTransformError(
    ctxt: *mut _xsltTransformContext,
    style: *mut _xsltStylesheet,
    inst: *mut _xmlNode,
    msg: *const c_char,
)
Expand description

Report an XSLT error.

Faithful port of upstream xsltutils.c xsltTransformError: the transform context is moved to the error state, the error context line is printed (upstream xsltPrintErrorContext), and the message is emitted verbatim through the registered handler or stderr. Messages carry their own trailing newline, exactly as upstream’s do — no newline is added here.

The upstream signature is variadic (const char *msg, ...); the candidate’s callers format the message before calling (a %s/%d placeholder is never expanded by this function).

§Parameters

  • ctxt — The transform context (may be null).
  • style — The stylesheet (may be null).
  • inst — The instruction node that triggered the error (may be null).
  • msg — The message, NUL-terminated, typically ending in \n.

§Safety

  • msg must be NULL or a valid NUL-terminated C string; it is read with libc::strlen and converted to a byte slice, so it must not be dangling.
  • ctxt must be NULL or a valid _xsltTransformContext; it is dereferenced to read state, inst, error, and errctx, and a registered error handler must be a valid extern “C” function pointer callable with errctx and the formatted message.
  • inst must be NULL or a valid _xmlNode; it is passed to print_error_context, which dereferences it.
  • style is only used in NULL comparisons and may be NULL.