patch from Mark Vadoc to allow compiling against libxml2 without XPointer
authorDaniel Veillard <veillard@src.gnome.org>
Mon, 1 Sep 2003 21:03:32 +0000 (21:03 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Mon, 1 Sep 2003 21:03:32 +0000 (21:03 +0000)
* libxslt/function.c: patch from Mark Vadoc to allow compiling
  against libxml2 without XPointer supoort.
Daniel

ChangeLog
libxslt/functions.c

index 0baad8b..45c639b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Sep  1 23:02:12 CEST 2003 Daniel Veillard <daniel@veillard.com>
+
+       * libxslt/function.c: patch from Mark Vadoc to allow compiling
+         against libxml2 without XPointer supoort.
+
 Fri Aug 29 12:28:12 CEST 2003 Daniel Veillard <daniel@veillard.com>
 
        * libxslt/transform.c: fixing the bug #120971 on cdata-section-elements
index 1954f7b..e66622c 100644 (file)
@@ -106,8 +106,8 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
     xmlChar *fragment;
     xsltDocumentPtr xsltdoc;
     xmlDocPtr doc;
-    xmlXPathContextPtr xptrctxt;
-    xmlXPathObjectPtr object;
+    xmlXPathContextPtr xptrctxt = NULL;
+    xmlXPathObjectPtr object = NULL;
 
     tctxt = xsltXPathGetTransformContext(ctxt);
     if (tctxt == NULL) {
@@ -161,7 +161,7 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
     }
        
     /* use XPointer of HTML location for fragment ID */
-    
+#ifdef LIBXML_XPTR_ENABLED
     xptrctxt = xmlXPtrNewContext(doc, NULL, NULL);
     if (xptrctxt == NULL) {
        xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
@@ -170,8 +170,10 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
     }
 
     object = xmlXPtrEval(fragment, xptrctxt);
+#endif
     xmlFree(fragment);
-    xmlXPathFreeContext(xptrctxt);
+       if (xptrctxt != NULL)
+               xmlXPathFreeContext(xptrctxt);
 
     if (object == NULL)
        goto out_fragment;