[libxslt] Set namespaces before evaluating xsl:number



commit 0efc716c0cfbe4f8706865a92e9789cf8386f3b4
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sun Dec 15 14:34:03 2013 +0100

    Set namespaces before evaluating xsl:number
    
    Fixes bug #712173.

 libxslt/transform.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/libxslt/transform.c b/libxslt/transform.c
index e68ee1d..07b4e5c 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -4594,6 +4594,10 @@ xsltNumber(xsltTransformContextPtr ctxt, xmlNodePtr node,
 #else
     xsltStylePreCompPtr comp = castedComp;
 #endif
+    xmlXPathContextPtr xpctxt;
+    xmlNsPtr *oldXPNamespaces;
+    int oldXPNsNr;
+
     if (comp == NULL) {
        xsltTransformError(ctxt, NULL, inst,
             "xsl:number : compilation failed\n");
@@ -4606,7 +4610,27 @@ xsltNumber(xsltTransformContextPtr ctxt, xmlNodePtr node,
     comp->numdata.doc = inst->doc;
     comp->numdata.node = inst;
 
+    xpctxt = ctxt->xpathCtxt;
+    oldXPNsNr = xpctxt->nsNr;
+    oldXPNamespaces = xpctxt->namespaces;
+
+#ifdef XSLT_REFACTORED
+    if (comp->inScopeNs != NULL) {
+        xpctxt->namespaces = comp->inScopeNs->list;
+        xpctxt->nsNr = comp->inScopeNs->xpathNumber;
+    } else {
+        xpctxt->namespaces = NULL;
+        xpctxt->nsNr = 0;
+    }
+#else
+    xpctxt->namespaces = comp->nsList;
+    xpctxt->nsNr = comp->nsNr;
+#endif
+
     xsltNumberFormat(ctxt, &comp->numdata, node);
+
+    xpctxt->nsNr = oldXPNsNr;
+    xpctxt->namespaces = oldXPNamespaces;
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]