+Fri Oct 31 15:53:45 CET 2003 Daniel Veillard <daniel@veillard.com>
+
+ * libxslt/documents.c libxslt/imports.c libxslt/xslt.c libxslt/xslt.h
+ xsltproc/xsltproc.c: switch to use xmlReadfile instead of
+ xmlParseFile, this avoid relying on global parser options, far
+ far cleaner.
+ * tests/XSLTMark/xslbench1.out tests/general/bug-90.out: fixes a
+ slightly corrected output for CDATA and STYLE element save.
+
Tue Oct 28 15:30:54 CET 2003 Daniel Veillard <daniel@veillard.com>
* configure.in python/Makefile.am python/tests/Makefile.am: applied
ret = ret->next;
}
+#ifdef XSLT_PARSE_OPTIONS
+ doc = xmlReadFile((const char *) URI, NULL, XSLT_PARSE_OPTIONS);
+#else
doc = xmlParseFile((const char *) URI);
+#endif
if (doc == NULL)
return(NULL);
ret = ret->next;
}
+#ifdef XSLT_PARSE_OPTIONS
+ doc = xmlReadFile((const char *) URI, NULL, XSLT_PARSE_OPTIONS);
+#else
doc = xmlParseFile((const char *) URI);
+#endif
if (doc == NULL)
return(NULL);
}
}
- import = xmlParseFile((const char *)URI);
+#ifdef XSLT_PARSE_OPTIONS
+ import = xmlReadFile((const char *) URI, NULL, XSLT_PARSE_OPTIONS);
+#else
+ import = xmlParseFile((const char *) URI);
+#endif
if (import == NULL) {
xsltTransformError(NULL, style, cur,
"xsl:import : unable to load %s\n", URI);
}
}
+#ifdef XSLT_PARSE_OPTIONS
+ doc = xmlReadFile((const char *) filename, NULL, XSLT_PARSE_OPTIONS);
+#else
doc = xmlParseFile((const char *) filename);
+#endif
if (doc == NULL) {
xsltTransformError(NULL, NULL, NULL,
"xsltParseStylesheetFile : cannot parse %s\n", filename);
subtree = ID->parent;
fake = xmlNewDoc(NULL);
if (fake != NULL) {
+#if LIBXML_VERSION >= 20600
+ /*
+ * the dictionnary should be shared since nodes are
+ * moved over.
+ */
+ fake->dict = doc->dict;
+ xmlDictReference(doc->dict);
+#endif
xmlUnlinkNode(subtree);
xmlAddChild((xmlNodePtr) fake, subtree);
ret = xsltParseStylesheetDoc(fake);
*/
#define XSLT_NAMESPACE ((xmlChar *) "http://www.w3.org/1999/XSL/Transform")
+#if LIBXML_VERSION >= 20600
+/**
+ * XSLT_PARSE_OPTIONS:
+ *
+ * The set of options to pass to an xmlReadxxx when loading files for
+ * XSLT consumption.
+ */
+#define XSLT_PARSE_OPTIONS \
+ XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOCDATA
+#endif
/**
* xsltMaxDepth:
*
<META content="TFI Technology Ltd Home of StayAlive, the premier crash protection software." name="DC.Description">
<META content="TFI Technology" name="DC.Publisher">
<META content="TFI Technology" name="DC.Contributors">
-<SCRIPT language="JavaScript">
+<SCRIPT language="JavaScript">
+
if (document.images)
{
}
}
//
+
</SCRIPT>
</HEAD>
<BODY background="TFI Technology Products_files/WaterMark.gif" bgColor="#ffffff" bgProperties="fixed"><TABLE border="0" cellPadding="0" cellSpacing="0" height="516" width="125"><TBODY>
<?xml version="1.0"?>
- <new-fruit1 type="apples">
-<![CDATA[
+ <new-fruit1 type="apples"><![CDATA[
The site is at
http://www.apples.com/site?args&stuff
- ]]>
-</new-fruit1><new-fruit2 type="apples"><![CDATA[
+ ]]></new-fruit1><new-fruit2 type="apples"><![CDATA[
The site is at http://www.apples.com/site?args&stuff
]]></new-fruit2>
- <new-fruit1 type="pears">
-<![CDATA[
+ <new-fruit1 type="pears"><![CDATA[
The site is at
- http://www.pears.com/index.html]]>
-</new-fruit1><new-fruit2 type="pears"><![CDATA[
+ http://www.pears.com/index.html]]></new-fruit1><new-fruit2 type="pears"><![CDATA[
The site is at http://www.pears.com/index.html]]></new-fruit2>
#ifdef LIBXML_CATALOG_ENABLED
#include <libxml/catalog.h>
#endif
+#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/uri.h>
#define MAX_PARAMETERS 64
#define MAX_PATHS 64
+#if LIBXML_VERSION >= 20600
+static int options = XSLT_PARSE_OPTIONS;
+#endif
static const char *params[MAX_PARAMETERS + 1];
static int nbparams = 0;
static xmlChar *strparams[MAX_PARAMETERS + 1];
res = xsltApplyStylesheet(cur, doc, params);
xmlFreeDoc(res);
xmlFreeDoc(doc);
+#if LIBXML_VERSION >= 20600
+#ifdef LIBXML_HTML_ENABLED
+ if (html)
+ doc = htmlReadFile(filename, NULL, options);
+ else
+#endif
+ doc = xmlReadFile(filename, NULL, options);
+#else
#ifdef LIBXML_HTML_ENABLED
if (html)
doc = htmlParseFile(filename, NULL);
else
#endif
doc = xmlParseFile(filename);
+#endif
}
}
ctxt = xsltNewTransformContext(cur, doc);
LIBXML_TEST_VERSION
- xmlLineNumbersDefault(1);
sec = xsltNewSecurityPrefs();
xsltSetDefaultSecurityPrefs(sec);
defaultEntityLoader = xmlGetExternalEntityLoader();
}
params[nbparams] = NULL;
+#if LIBXML_VERSION < 20600
+ /*
+ * The old parser interfaces uses the global variables
+ */
if (novalid == 0)
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
else
xmlLoadExtDtdDefaultValue = 0;
-
-
- /*
- * Replace entities with their content.
- */
xmlSubstituteEntitiesDefault(1);
+ xmlLineNumbersDefault(1);
+#endif
/*
* Register the EXSLT extensions and the test module
if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
if (timing)
startTimer();
+#if LIBXML_VERSION >= 20600
+ style = xmlReadFile((const char *) argv[i], NULL, options);
+#else
style = xmlParseFile((const char *) argv[i]);
+#endif
if (timing)
endTimer("Parsing stylesheet %s", argv[i]);
if (style == NULL) {
}
}
+#if LIBXML_VERSION < 20600
/*
+ * The old parser interfaces uses the global variables
* disable CDATA from being built in the document tree
*/
xmlDefaultSAXHandlerInit();
xmlDefaultSAXHandler.cdataBlock = NULL;
+#endif
if ((cur != NULL) && (cur->errors == 0)) {
for (; i < argc; i++) {
doc = NULL;
if (timing)
startTimer();
+#if LIBXML_VERSION >= 20600
+#ifdef LIBXML_HTML_ENABLED
+ if (html)
+ doc = htmlReadFile(argv[i], NULL, options);
+ else
+#endif
+ doc = xmlReadFile(argv[i], NULL, options);
+#else
#ifdef LIBXML_HTML_ENABLED
if (html)
doc = htmlParseFile(argv[i], NULL);
else
#endif
doc = xmlParseFile(argv[i]);
+#endif
if (doc == NULL) {
fprintf(stderr, "unable to parse %s\n", argv[i]);
errorno = 6;