* Summary: set of utilities for the XSLT engine
* Description: interfaces for the utilities module of the XSLT engine.
* things like message handling, profiling, and other
* generally useful routines.
* Copy: See Copyright for the status of this software.
* Author: Daniel Veillard
#ifndef __XML_XSLTUTILS_H__
#define __XML_XSLTUTILS_H__
#include <libxslt/xsltconfig.h>
#include <libxml/xpath.h>
#include <libxml/xmlerror.h>
#include "xsltInternals.h"
* Macro to flag unimplemented blocks.
xsltGenericError(xsltGenericErrorContext, \
"Unimplemented block at %s:%d\n", \
* Macro to flag that a problem was detected internally.
xsltGenericError(xsltGenericErrorContext, \
"Internal error at %s:%d\n", \
* Checks that the element pertains to XSLT namespace.
#define IS_XSLT_ELEM(n) \
(((n) != NULL) && ((n)->type == XML_ELEMENT_NODE) && \
((n)->ns != NULL) && (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
* Checks the value of an element in XSLT namespace.
#define IS_XSLT_NAME(n, val) \
(xmlStrEqual((n)->name, (const xmlChar *) (val)))
* Check that a node is a 'real' one: document, element, text or attribute.
#define IS_XSLT_REAL_NODE(n) \
(((n)->type == XML_ELEMENT_NODE) || \
((n)->type == XML_TEXT_NODE) || \
((n)->type == XML_CDATA_SECTION_NODE) || \
((n)->type == XML_ATTRIBUTE_NODE) || \
((n)->type == XML_DOCUMENT_NODE) || \
((n)->type == XML_HTML_DOCUMENT_NODE) || \
((n)->type == XML_COMMENT_NODE) || \
((n)->type == XML_PI_NODE)))
* Our own version of namespaced atributes lookup.
XSLTPUBFUN xmlChar * XSLTCALL
xsltGetNsProp (xmlNodePtr node,
const xmlChar *nameSpace);
XSLTPUBFUN const xmlChar * XSLTCALL
xsltGetCNsProp (xsltStylesheetPtr style,
const xmlChar *nameSpace);
xsltGetUTF8Char (const unsigned char *utf,
* XSLT Debug Tracing Tracing Types
XSLT_TRACE_COPY_TEXT = 1<<0,
XSLT_TRACE_PROCESS_NODE = 1<<1,
XSLT_TRACE_APPLY_TEMPLATE = 1<<2,
XSLT_TRACE_COMMENT = 1<<4,
XSLT_TRACE_COPY_OF = 1<<6,
XSLT_TRACE_VALUE_OF = 1<<7,
XSLT_TRACE_CALL_TEMPLATE = 1<<8,
XSLT_TRACE_APPLY_TEMPLATES = 1<<9,
XSLT_TRACE_CHOOSE = 1<<10,
XSLT_TRACE_FOR_EACH = 1<<12,
XSLT_TRACE_STRIP_SPACES = 1<<13,
XSLT_TRACE_TEMPLATES = 1<<14,
XSLT_TRACE_VARIABLES = 1<<16
* Control the type of xsl debugtrace messages emitted.
#define XSLT_TRACE(ctxt,code,call) \
if (ctxt->traceCode && (*(ctxt->traceCode) & code)) \
xsltDebugSetDefaultTrace(xsltDebugTraceCodes val);
XSLTPUBFUN xsltDebugTraceCodes XSLTCALL
xsltDebugGetDefaultTrace(void);
* XSLT specific error and debug reporting functions.
XSLTPUBVAR xmlGenericErrorFunc xsltGenericError;
XSLTPUBVAR void *xsltGenericErrorContext;
XSLTPUBVAR xmlGenericErrorFunc xsltGenericDebug;
XSLTPUBVAR void *xsltGenericDebugContext;
xsltPrintErrorContext (xsltTransformContextPtr ctxt,
xsltMessage (xsltTransformContextPtr ctxt,
xsltSetGenericErrorFunc (void *ctx,
xmlGenericErrorFunc handler);
xsltSetGenericDebugFunc (void *ctx,
xmlGenericErrorFunc handler);
xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt,
xmlGenericErrorFunc handler);
xsltTransformError (xsltTransformContextPtr ctxt,
...) LIBXSLT_ATTR_FORMAT(4,5);
xsltSetCtxtParseOptions (xsltTransformContextPtr ctxt,
xsltDocumentSortFunction (xmlNodeSetPtr list);
xsltSetSortFunc (xsltSortFunc handler);
xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt,
xsltDefaultSortFunction (xsltTransformContextPtr ctxt,
xsltDoSortFunction (xsltTransformContextPtr ctxt,
XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL
xsltComputeSortResult (xsltTransformContextPtr ctxt,
XSLTPUBFUN const xmlChar * XSLTCALL
xsltSplitQName (xmlDictPtr dict,
XSLTPUBFUN const xmlChar * XSLTCALL
xsltGetQNameURI (xmlNodePtr node,
XSLTPUBFUN const xmlChar * XSLTCALL
xsltGetQNameURI2 (xsltStylesheetPtr style,
* Output, reuse libxml I/O buffers.
xsltSaveResultTo (xmlOutputBufferPtr buf,
xsltStylesheetPtr style);
xsltSaveResultToFilename (const char *URI,
xsltSaveResultToFile (FILE *file,
xsltStylesheetPtr style);
xsltSaveResultToFd (int fd,
xsltStylesheetPtr style);
xsltSaveResultToString (xmlChar **doc_txt_ptr,
xsltStylesheetPtr style);
XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
xsltXPathCompile (xsltStylesheetPtr style,
XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
xsltXPathCompileFlags (xsltStylesheetPtr style,
xsltSaveProfiling (xsltTransformContextPtr ctxt,
XSLTPUBFUN xmlDocPtr XSLTCALL
xsltGetProfileInformation (xsltTransformContextPtr ctxt);
xsltCalibrateAdjust (long delta);
* XSLT_TIMESTAMP_TICS_PER_SEC:
* Sampling precision for profiling
#define XSLT_TIMESTAMP_TICS_PER_SEC 100000l
* Hooks for the debugger.
XSLT_DEBUG_NONE = 0, /* no debugging allowed */
XSLTPUBVAR int xslDebugStatus;
typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node,
xsltTemplatePtr templ, xsltTransformContextPtr ctxt);
typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source);
typedef void (*xsltDropCallCallback) (void);
xsltSetDebuggerStatus (int value);
xsltGetDebuggerStatus (void);
xsltSetDebuggerCallbacks (int no, void *block);
xslAddCall (xsltTemplatePtr templ,
#endif /* __XML_XSLTUTILS_H__ */