summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libxslt/keys.c9
-rw-r--r--libxslt/pattern.c1
-rw-r--r--libxslt/xsltutils.c22
-rw-r--r--libxslt/xsltutils.h4
4 files changed, 34 insertions, 2 deletions
diff --git a/libxslt/keys.c b/libxslt/keys.c
index d28aea67..d85e12c7 100644
--- a/libxslt/keys.c
+++ b/libxslt/keys.c
@@ -21,6 +21,7 @@
#include <libxml/xmlerror.h>
#include <libxml/parserInternals.h>
#include <libxml/xpathInternals.h>
+#include <libxml/xpath.h>
#include "xslt.h"
#include "xsltInternals.h"
#include "xsltutils.h"
@@ -356,14 +357,22 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
* Maybe a search for "$", if it occurs outside of quotation
* marks, could be sufficient.
*/
+#ifdef XML_XPATH_NOVAR
+ key->comp = xsltXPathCompileFlags(style, pattern, XML_XPATH_NOVAR);
+#else
key->comp = xsltXPathCompile(style, pattern);
+#endif
if (key->comp == NULL) {
xsltTransformError(NULL, style, inst,
"xsl:key : XPath pattern compilation failed '%s'\n",
pattern);
if (style != NULL) style->errors++;
}
+#ifdef XML_XPATH_NOVAR
+ key->usecomp = xsltXPathCompileFlags(style, use, XML_XPATH_NOVAR);
+#else
key->usecomp = xsltXPathCompile(style, use);
+#endif
if (key->usecomp == NULL) {
xsltTransformError(NULL, style, inst,
"xsl:key : XPath pattern compilation failed '%s'\n",
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index a6140cba..fc6455f7 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -25,6 +25,7 @@
#include <libxml/hash.h>
#include <libxml/xmlerror.h>
#include <libxml/parserInternals.h>
+#include <libxml/xpath.h>
#include "xslt.h"
#include "xsltInternals.h"
#include "xsltutils.h"
diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c
index bc942668..d239162e 100644
--- a/libxslt/xsltutils.c
+++ b/libxslt/xsltutils.c
@@ -2273,9 +2273,10 @@ xsltGetProfileInformation(xsltTransformContextPtr ctxt)
************************************************************************/
/**
- * xsltXPathCompile:
+ * xsltXPathCompileFlags:
* @style: the stylesheet
* @str: the XPath expression
+ * @flags: extra compilation flags to pass down to libxml2 XPath
*
* Compile an XPath expression
*
@@ -2283,7 +2284,7 @@ xsltGetProfileInformation(xsltTransformContextPtr ctxt)
* the caller has to free the object.
*/
xmlXPathCompExprPtr
-xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) {
+xsltXPathCompileFlags(xsltStylesheetPtr style, const xmlChar *str, int flags) {
xmlXPathContextPtr xpathCtxt;
xmlXPathCompExprPtr ret;
@@ -2315,6 +2316,8 @@ xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) {
if (xpathCtxt == NULL)
return NULL;
}
+ xpathCtxt->flags = flags;
+
/*
* Compile the expression.
*/
@@ -2335,6 +2338,21 @@ xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) {
return(ret);
}
+/**
+ * xsltXPathCompile:
+ * @style: the stylesheet
+ * @str: the XPath expression
+ *
+ * Compile an XPath expression
+ *
+ * Returns the xmlXPathCompExprPtr resulting from the compilation or NULL.
+ * the caller has to free the object.
+ */
+xmlXPathCompExprPtr
+xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) {
+ return(xsltXPathCompileFlags(style, str, 0));
+}
+
/************************************************************************
* *
* Hooks for the debugger *
diff --git a/libxslt/xsltutils.h b/libxslt/xsltutils.h
index c986a9c7..15da89c6 100644
--- a/libxslt/xsltutils.h
+++ b/libxslt/xsltutils.h
@@ -242,6 +242,10 @@ XSLTPUBFUN int XSLTCALL
XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
xsltXPathCompile (xsltStylesheetPtr style,
const xmlChar *str);
+XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
+ xsltXPathCompileFlags (xsltStylesheetPtr style,
+ const xmlChar *str,
+ int flags);
/*
* Profiling.