mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-29 15:41:13 +03:00
fixed a bug w.r.t. namespace context when doing the evaluation of
* libxslt/templates.c: fixed a bug w.r.t. namespace context when doing the evaluation of attribute value templates * libxslt.spec.in python/Makefile.am: fixed some troubles with "make rpm" Daniel
This commit is contained in:
@ -1,3 +1,10 @@
|
||||
Wed Aug 21 21:27:29 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* libxslt/templates.c: fixed a bug w.r.t. namespace context when
|
||||
doing the evaluation of attribute value templates
|
||||
* libxslt.spec.in python/Makefile.am: fixed some troubles
|
||||
with "make rpm"
|
||||
|
||||
Wed Aug 21 18:59:28 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* python/libxslt.c: fixed the parameter order when calling
|
||||
|
@ -79,7 +79,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
install -d $RPM_BUILD_ROOT%{_mandir}/man1
|
||||
install -d $RPM_BUILD_ROOT%{_mandir}/man4
|
||||
make prefix=$RPM_BUILD_ROOT%{prefix} mandir=$RPM_BUILD_ROOT%{_mandir} install
|
||||
make prefix=$RPM_BUILD_ROOT%{prefix} mandir=$RPM_BUILD_ROOT%{_mandir} \
|
||||
install
|
||||
|
||||
#
|
||||
# this is a bit ugly but tries to generate the bindings for all versions
|
||||
@ -96,7 +97,8 @@ do
|
||||
make PYTHON="%{prefix}/bin/python$py_version" \
|
||||
PYTHON_VERSION="$py_version" \
|
||||
prefix=$RPM_BUILD_ROOT%{prefix} \
|
||||
mandir=$RPM_BUILD_ROOT%{_mandir} install)
|
||||
mandir=$RPM_BUILD_ROOT%{_mandir} \
|
||||
install)
|
||||
fi
|
||||
done
|
||||
%clean
|
||||
|
@ -100,17 +100,21 @@ xsltEvalXPathPredicate(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp,
|
||||
}
|
||||
|
||||
/**
|
||||
* xsltEvalXPathString:
|
||||
* xsltEvalXPathStringNs:
|
||||
* @ctxt: the XSLT transformation context
|
||||
* @comp: the compiled XPath expression
|
||||
* @nsNr: the number of namespaces in the list
|
||||
* @nsList: the list of in-scope namespaces to use
|
||||
*
|
||||
* Process the expression using XPath and get a string
|
||||
* Process the expression using XPath, allowing to pass a namespace mapping
|
||||
* context and get a string
|
||||
*
|
||||
* Returns the computed string value or NULL, must be deallocated by the
|
||||
* caller.
|
||||
*/
|
||||
xmlChar *
|
||||
xsltEvalXPathString(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp) {
|
||||
xsltEvalXPathStringNs(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp,
|
||||
int nsNr, xmlNsPtr *nsList) {
|
||||
xmlChar *ret = NULL;
|
||||
xmlXPathObjectPtr res;
|
||||
xmlNodePtr oldInst;
|
||||
@ -128,8 +132,8 @@ xsltEvalXPathString(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp) {
|
||||
|
||||
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);
|
||||
if (res != NULL) {
|
||||
if (res->type != XPATH_STRING)
|
||||
@ -159,6 +163,21 @@ xsltEvalXPathString(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp) {
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* xsltEvalXPathString:
|
||||
* @ctxt: the XSLT transformation context
|
||||
* @comp: the compiled XPath expression
|
||||
*
|
||||
* Process the expression using XPath and get a string
|
||||
*
|
||||
* Returns the computed string value or NULL, must be deallocated by the
|
||||
* caller.
|
||||
*/
|
||||
xmlChar *
|
||||
xsltEvalXPathString(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp) {
|
||||
return(xsltEvalXPathStringNs(ctxt, comp, 0, NULL));
|
||||
}
|
||||
|
||||
/**
|
||||
* xsltEvalTemplateString:
|
||||
* @ctxt: the XSLT transformation context
|
||||
@ -202,20 +221,26 @@ xsltEvalTemplateString(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
}
|
||||
|
||||
/**
|
||||
* xsltAttrTemplateValueProcess:
|
||||
* xsltAttrTemplateValueProcessNode:
|
||||
* @ctxt: the XSLT transformation context
|
||||
* @str: the attribute template node value
|
||||
* @node: the node hosting the attribute
|
||||
* @nsList: the list of in-scope namespaces to use
|
||||
*
|
||||
* Process the given node and return the new string value.
|
||||
* Process the given string, allowing to pass a namespace mapping
|
||||
* context and return the new string value.
|
||||
*
|
||||
* Returns the computed string value or NULL, must be deallocated by the
|
||||
* caller.
|
||||
*/
|
||||
xmlChar *
|
||||
xsltAttrTemplateValueProcess(xsltTransformContextPtr ctxt, const xmlChar *str) {
|
||||
xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
|
||||
const xmlChar *str, xmlNodePtr node) {
|
||||
xmlChar *ret = NULL;
|
||||
const xmlChar *cur;
|
||||
xmlChar *expr, *val;
|
||||
xmlNsPtr *nsList = NULL;
|
||||
int nsNr = 0;
|
||||
|
||||
if (str == NULL) return(NULL);
|
||||
if (*str == 0)
|
||||
@ -244,8 +269,18 @@ xsltAttrTemplateValueProcess(xsltTransformContextPtr ctxt, const xmlChar *str) {
|
||||
/*
|
||||
* TODO: keep precompiled form around
|
||||
*/
|
||||
if (nsList == NULL) {
|
||||
int i = 0;
|
||||
|
||||
nsList = xmlGetNsList(node->doc, node);
|
||||
if (nsList != NULL) {
|
||||
while (nsList[i] != NULL)
|
||||
i++;
|
||||
nsNr = i;
|
||||
}
|
||||
}
|
||||
comp = xmlXPathCompile(expr);
|
||||
val = xsltEvalXPathString(ctxt, comp);
|
||||
val = xsltEvalXPathStringNs(ctxt, comp, nsNr, nsList);
|
||||
xmlXPathFreeCompExpr(comp);
|
||||
xmlFree(expr);
|
||||
if (val != NULL) {
|
||||
@ -262,9 +297,27 @@ xsltAttrTemplateValueProcess(xsltTransformContextPtr ctxt, const xmlChar *str) {
|
||||
ret = xmlStrncat(ret, str, cur - str);
|
||||
}
|
||||
|
||||
if (nsList != NULL)
|
||||
xmlFree(nsList);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* xsltAttrTemplateValueProcess:
|
||||
* @ctxt: the XSLT transformation context
|
||||
* @str: the attribute template node value
|
||||
*
|
||||
* Process the given node and return the new string value.
|
||||
*
|
||||
* Returns the computed string value or NULL, must be deallocated by the
|
||||
* caller.
|
||||
*/
|
||||
xmlChar *
|
||||
xsltAttrTemplateValueProcess(xsltTransformContextPtr ctxt, const xmlChar *str) {
|
||||
return(xsltAttrTemplateValueProcessNode(ctxt, str, NULL));
|
||||
}
|
||||
|
||||
/**
|
||||
* xsltEvalAttrValueTemplate:
|
||||
* @ctxt: the XSLT transformation context
|
||||
@ -298,7 +351,7 @@ xsltEvalAttrValueTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
* attribute content and the XPath precompiled expressions around
|
||||
*/
|
||||
|
||||
ret = xsltAttrTemplateValueProcess(ctxt, expr);
|
||||
ret = xsltAttrTemplateValueProcessNode(ctxt, expr, node);
|
||||
#ifdef WITH_XSLT_DEBUG_TEMPLATES
|
||||
xsltGenericDebug(xsltGenericDebugContext,
|
||||
"xsltEvalAttrValueTemplate: %s returns %s\n", expr, ret);
|
||||
@ -392,7 +445,7 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
|
||||
|
||||
/* TODO: optimize if no template value was detected */
|
||||
if (in != NULL) {
|
||||
out = xsltAttrTemplateValueProcess(ctxt, in);
|
||||
out = xsltAttrTemplateValueProcessNode(ctxt, in, cur->parent);
|
||||
ret = xmlSetNsProp(target, ns, cur->name, out);
|
||||
if (out != NULL)
|
||||
xmlFree(out);
|
||||
|
@ -42,11 +42,11 @@ libxslt.py: $(srcdir)/libxsl.py libxsltclass.py
|
||||
cat $(srcdir)/libxsl.py libxsltclass.py > libxslt.py
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(PYTHON_SITE_PACKAGES)
|
||||
-@INSTALL@ -m 0644 libxslt.py $(DESTDIR)$(PYTHON_SITE_PACKAGES)
|
||||
$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
|
||||
-@(for doc in $(DOCS) ; \
|
||||
do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
|
||||
$(mkinstalldirs) $(libdir)/python${PYTHON_VERSION}/site-packages
|
||||
@INSTALL@ -m 0644 libxslt.py $(libdir)/python${PYTHON_VERSION}/site-packages
|
||||
$(mkinstalldirs) $(DOCS_DIR)
|
||||
@(for doc in $(DOCS) ; \
|
||||
do @INSTALL@ -m 0644 $$doc $(DOCS_DIR) ; done)
|
||||
|
||||
GENERATE = generator.py
|
||||
API_DESC = $(top_srcdir)/doc/libxslt-api.xml $(srcdir)/libxslt-python-api.xml
|
||||
|
Reference in New Issue
Block a user