+Mon Apr 30 22:31:59 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * tests/general/bug-8-.out: fixed in libxml xpath
+ * libxslt/templates.[ch] libxslt/pattern.c: fixed an namespace
+ problem in predicates within a pattern. Spotted another
+ potential namespace problem
+
Mon Apr 30 19:29:34 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* libxslt/preproc.c libxslt/xslt.c libxslt/xsltInternals.h
/* TODO fix the statically allocated size steps[] */
int nbStep;
int maxStep;
+ xmlNsPtr *nsList; /* the namespaces in scope */
+ int nsNr; /* the number of namespaces in scope */
xsltStepOp steps[20]; /* ops for computation */
};
}
memset(cur, 0, sizeof(xsltCompMatch));
cur->maxStep = 20;
+ cur->nsNr = 0;
+ cur->nsList = NULL;
return(cur);
}
xmlFree((xmlChar *)comp->mode);
if (comp->modeURI != NULL)
xmlFree((xmlChar *)comp->modeURI);
+ if (comp->nsList != NULL)
+ xmlFree(comp->nsList);
for (i = 0;i < comp->nbStep;i++) {
op = &comp->steps[i];
if (op->value != NULL)
if (step->comp == NULL)
goto wrong_index;
}
- if (!xsltEvalXPathPredicate(ctxt, step->comp))
+ if (comp->nsList == NULL) {
+ int j = 0;
+
+ comp->nsList = xmlGetNsList(node->doc, node);
+ if (comp->nsList != NULL) {
+ while (comp->nsList[j] != NULL)
+ j++;
+ }
+ comp->nsNr = j;
+ }
+ if (!xsltEvalXPathPredicate(ctxt, step->comp, comp->nsList,
+ comp->nsNr))
goto wrong_index;
if (pos != 0) {
* xsltEvalXPathPredicate:
* @ctxt: the XSLT transformation context
* @comp: the XPath compiled expression
+ * @nsList: the namespaces in scope
+ * @int nsNr: the number of namespaces in scope
*
* Process the expression using XPath and evaluate the result as
* an XPath predicate
* Returns 1 is the predicate was true, 0 otherwise
*/
int
-xsltEvalXPathPredicate(xsltTransformContextPtr ctxt,
- xmlXPathCompExprPtr comp) {
+xsltEvalXPathPredicate(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp,
+ xmlNsPtr *nsList, int nsNr) {
int ret, position;
xmlXPathObjectPtr res;
position = ctxt->xpathCtxt->proximityPosition;
ctxt->xpathCtxt->node = ctxt->node;
- /* TODO: do we need to propagate the namespaces here ? */
- ctxt->xpathCtxt->namespaces = NULL;
- ctxt->xpathCtxt->nsNr = 0;
+ ctxt->xpathCtxt->namespaces = nsList;
+ ctxt->xpathCtxt->nsNr = nsNr;
res = xmlXPathCompiledEval(comp, ctxt->xpathCtxt);
ctxt->xpathCtxt->proximityPosition = position;
if (res != NULL) {
#endif
int xsltEvalXPathPredicate (xsltTransformContextPtr ctxt,
- xmlXPathCompExprPtr comp);
+ xmlXPathCompExprPtr comp,
+ xmlNsPtr *nsList,
+ int nsNr);
xmlChar * xsltEvalTemplateString (xsltTransformContextPtr ctxt,
xmlNodePtr node,
xmlNodePtr parent);
const xmlChar *name,
const xmlChar *ns,
int *found);
+
+/* TODO: this is obviously broken ... the namespaces should be passed too ! */
xmlChar * xsltEvalXPathString (xsltTransformContextPtr ctxt,
xmlXPathCompExprPtr comp);
+
xmlNodePtr * xsltTemplateProcess (xsltTransformContextPtr ctxt,
xmlNodePtr node);
xmlAttrPtr xsltAttrListTemplateProcess (xsltTransformContextPtr ctxt,
<?xml version="1.0"?>
- Big
+ Big Success