+Sun Jan 28 21:45:23 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * FEATURES TODO: updates
+ * libxslt/xsltutils.[ch] libxslt/xsltInternals.h libxslt/xsltutils.h:
+ added xsl:message
+
Sun Jan 28 17:25:35 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* FEATURES TODO: updates
NO digit = char
NO pattern-separator = char
-NO xsl:message
-NO terminate = "yes" | "no"
+YES xsl:message
+YES terminate = "yes" | "no"
NO xsl:fallback
Extra functions:
-> document() should not be a problem since Result Tree Fragments are
- implemnted
+ implemented
=> started, incomplete
-> missing key support
Pattern scanner:
-> add error checks on all returns
- -> handle unions
Error handling:
-> check the version stuff, design a separate module for error interfacing
Pattern scanner:
-> compute priority
+ -> handle unions
=> done
Pattern tester:
xmlNodePtr delete = NULL;
int strip_spaces = -1;
+ CHECK_STOPPED;
switch (node->type) {
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
}
cur = inst->children;
while (cur != NULL) {
+ CHECK_STOPPEDE;
if (IS_XSLT_ELEM(cur)) {
if (IS_XSLT_NAME(cur, "with-param")) {
if (has_param == 0) {
xmlNodePtr oldInsert;
int has_variables = 0;
+ CHECK_STOPPED;
oldInsert = insert = ctxt->insert;
/*
* Insert all non-XSLT nodes found in the template
has_variables = 1;
}
xsltCallTemplate(ctxt, node, cur);
+ } else if (IS_XSLT_NAME(cur, "message")) {
} else {
#ifdef DEBUG_PROCESS
xsltGenericError(xsltGenericDebugContext,
#endif
TODO
}
+ CHECK_STOPPED;
goto skip_children;
} else if (cur->type == XML_TEXT_NODE) {
/*
XSLT_OUTPUT_TEXT
} xsltOutputType;
+typedef enum {
+ XSLT_STATE_OK = 0,
+ XSLT_STATE_ERROR,
+ XSLT_STATE_STOPPED
+} xsltTransformState;
+
typedef struct _xsltTransformContext xsltTransformContext;
typedef xsltTransformContext *xsltTransformContextPtr;
struct _xsltTransformContext {
void *variablesHash; /* hash table or wherever variables
informations are stored */
xmlDocPtr extraDocs; /* extra docs parsed by document() */
+ xsltTransformState state; /* the current state */
};
+#define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
+#define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
+#define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
+
/*
* Functions associated to the internal types
*/
#include <libxml/xmlerror.h>
#include <libxml/xmlIO.h>
#include "xsltutils.h"
+#include "templates.h"
#include "xsltInternals.h"
/************************************************************************
* *
+ * Handling of XSLT stylesheets messages *
+ * *
+ ************************************************************************/
+
+/**
+ * xsltMessage:
+ * @ctxt: an XSLT processing context
+ * @node: The current node
+ * @inst: The node containing the message instruction
+ *
+ * Process and xsl:message construct
+ */
+void
+xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) {
+ xmlChar *prop, *message;
+ int terminate = 0;
+
+ if ((ctxt == NULL) || (inst == NULL))
+ return;
+
+ prop = xmlGetNsProp(inst, (const xmlChar *)"terminate", XSLT_NAMESPACE);
+ if (prop != NULL) {
+ if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
+ terminate = 1;
+ } else if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
+ terminate = 0;
+ } else {
+ xsltGenericError(xsltGenericErrorContext,
+ "xsl:message : terminate expecting 'yes' or 'no'\n");
+ }
+ xmlFree(prop);
+ }
+ message = xsltEvalTemplateString(ctxt, node, inst);
+ if (message != NULL) {
+ xsltGenericError(xsltGenericErrorContext, (const char *)message);
+ xmlFree(message);
+ }
+ if (terminate)
+ ctxt->state = XSLT_STATE_STOPPED;
+}
+
+/************************************************************************
+ * *
* Handling of out of context errors *
* *
************************************************************************/
extern xmlGenericErrorFunc xsltGenericDebug;
extern void *xsltGenericDebugContext;
+void xsltMessage (xsltTransformContextPtr ctxt,
+ xmlNodePtr node,
+ xmlNodePtr inst);
void xsltSetGenericErrorFunc (void *ctx,
xmlGenericErrorFunc handler);
void xsltSetGenericDebugFunc (void *ctx,