#include "xslt.h"
#include "xsltInternals.h"
#include "pattern.h"
+#include "xsltutils.h"
-/* #define DEBUG_PARSING */
-
-/*
- * To cleanup
- */
-xmlChar *xmlSplitQName2(const xmlChar *name, xmlChar **prefix);
-
-/*
- * There is no XSLT specific error reporting module yet
- */
-#define xsltGenericError xmlGenericError
-#define xsltGenericErrorContext xmlGenericErrorContext
+#define DEBUG_PARSING
/*
* Useful macros
*/
-#define IS_XSLT_ELEM(n) \
- ((n)->ns != NULL) && (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))
-
-#define IS_XSLT_NAME(n, val) \
- (xmlStrEqual((n)->name, (const xmlChar *) (val)))
-
#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \
((c) == 0x0D))
#define IS_BLANK_NODE(n) \
(((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
-#define TODO \
- xsltGenericError(xsltGenericErrorContext, \
- "Unimplemented block at %s:%d\n", \
- __FILE__, __LINE__);
-
-#define STRANGE \
- xsltGenericError(xsltGenericErrorContext, \
- "Internal error at %s:%d\n", \
- __FILE__, __LINE__);
/************************************************************************
* *
element = xmlStrndup(element, end - element);
if (element) {
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"add cdata section output element %s\n", element);
#endif
xmlHashAddEntry(style->stripSpaces, element, "cdata");
element = xmlStrndup(element, end - element);
if (element) {
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"add preserved space element %s\n", element);
#endif
xmlHashAddEntry(style->stripSpaces, element, "preserve");
element = xmlStrndup(element, end - element);
if (element) {
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"add stripped space element %s\n", element);
#endif
xmlHashAddEntry(style->stripSpaces, element, "strip");
while (cur != NULL) {
if (delete != NULL) {
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"xsltParseStylesheetTemplate: removing ignorable blank node\n");
#endif
xmlUnlinkNode(delete);
}
if (delete != NULL) {
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"xsltParseStylesheetTemplate: removing ignorable blank node\n");
#endif
xmlUnlinkNode(delete);
}
if (!(IS_XSLT_ELEM(cur))) {
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"xsltParseStylesheetTop : found foreign element %s\n",
cur->name);
#endif
}
if (!(IS_XSLT_ELEM(cur))) {
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"xsltParseStylesheetTop : found foreign element %s\n",
cur->name);
#endif
cur = cur->next;
}
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"parsed %d templates\n", templates);
#endif
}
}
ret->doc = doc;
- if ((IS_XSLT_ELEM(cur)) && (IS_XSLT_NAME(cur, "stylesheet"))) {
+ if ((IS_XSLT_ELEM(cur)) &&
+ ((IS_XSLT_NAME(cur, "stylesheet")) ||
+ (IS_XSLT_NAME(cur, "transform")))) {
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"xsltParseStylesheetDoc : found stylesheet\n");
#endif
}
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"xsltParseStylesheetDoc : document is stylesheet\n");
#endif
return(NULL);
#ifdef DEBUG_PARSING
- xsltGenericError(xsltGenericErrorContext,
+ xsltGenericDebug(xsltGenericDebugContext,
"xsltParseStylesheetFile : parse %s\n", filename);
#endif