From 0e4e81ebb27b3c9537a33f0a05b9464aa5e92f79 Mon Sep 17 00:00:00 2001 From: "William M. Brack" Date: Thu, 4 Mar 2004 15:10:18 +0000 Subject: fixed problem with dictionary handling (bug 135938). fixed a few more * libxslt/xsltutils.h, libxslt/xsltutils.c, libxslt/preproc.c: fixed problem with dictionary handling (bug 135938). * doc/EXSLT/*: fixed a few more "href_base" files. --- ChangeLog | 6 + doc/EXSLT/html/book1.html | 2 +- doc/EXSLT/html/index.html | 2 +- doc/EXSLT/html/libexslt-exslt.html | 2 +- doc/EXSLT/html/libexslt-exsltexports.html | 2 +- doc/EXSLT/html/libexslt-lib.html | 2 +- doc/EXSLT/libexslt-api.xml | 14 +- doc/libxslt-api.xml | 218 +++++++++++++++--------------- libxslt/preproc.c | 12 +- libxslt/xsltutils.c | 89 ++++++++++-- libxslt/xsltutils.h | 5 + 11 files changed, 215 insertions(+), 139 deletions(-) diff --git a/ChangeLog b/ChangeLog index 93d8cec2..782f2fd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Mar 4 23:02:18 HKT 2004 William Brack + + * libxslt/xsltutils.h, libxslt/xsltutils.c, libxslt/preproc.c: + fixed problem with dictionary handling (bug 135938). + * doc/EXSLT/*: fixed a few more "href_base" files. + Wed Mar 3 21:33:33 HKT 2004 William Brack * doc/*, doc/html/*, doc/EXSLT/*: rebuilt the docs to fix diff --git a/doc/EXSLT/html/book1.html b/doc/EXSLT/html/book1.html index 2b10276e..392bb122 100644 --- a/doc/EXSLT/html/book1.html +++ b/doc/EXSLT/html/book1.html @@ -7,4 +7,4 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } - Reference Manual for libexslt
Action against software patentsGnome2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The EXSLT C library for Gnome

Reference Manual for libexslt

API Menu
Related links
API Indexes

Table of Contents

Daniel Veillard

+ Reference Manual for libexslt
Action against software patentsGnome2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The EXSLT C library for Gnome

Reference Manual for libexslt

API Menu
Related links
API Indexes

Table of Contents

Daniel Veillard

diff --git a/doc/EXSLT/html/index.html b/doc/EXSLT/html/index.html index 2b10276e..392bb122 100644 --- a/doc/EXSLT/html/index.html +++ b/doc/EXSLT/html/index.html @@ -7,4 +7,4 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } - Reference Manual for libexslt
Action against software patentsGnome2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The EXSLT C library for Gnome

Reference Manual for libexslt

API Menu
Related links
API Indexes

Table of Contents

Daniel Veillard

+ Reference Manual for libexslt
Action against software patentsGnome2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The EXSLT C library for Gnome

Reference Manual for libexslt

API Menu
Related links
API Indexes

Table of Contents

Daniel Veillard

diff --git a/doc/EXSLT/html/libexslt-exslt.html b/doc/EXSLT/html/libexslt-exslt.html index 34eaa8a9..d377c6a5 100644 --- a/doc/EXSLT/html/libexslt-exslt.html +++ b/doc/EXSLT/html/libexslt-exslt.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } - Module exslt from libexslt
Action against software patentsGnome2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The EXSLT C library for Gnome

Module exslt from libexslt

API Menu
Related links
API Indexes

Table of Contents

#define EXSLT_COMMON_NAMESPACE
#define EXSLT_DATE_NAMESPACE
#define EXSLT_DYNAMIC_NAMESPACE
#define EXSLT_FUNCTIONS_NAMESPACE
#define EXSLT_MATH_NAMESPACE
#define EXSLT_SETS_NAMESPACE
#define EXSLT_STRINGS_NAMESPACE
#define SAXON_NAMESPACE
void	exsltCommonRegister		(void)
+ Module exslt from libexslt
Action against software patentsGnome2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The EXSLT C library for Gnome

Module exslt from libexslt

API Menu
Related links
API Indexes

Table of Contents

#define EXSLT_COMMON_NAMESPACE
#define EXSLT_DATE_NAMESPACE
#define EXSLT_DYNAMIC_NAMESPACE
#define EXSLT_FUNCTIONS_NAMESPACE
#define EXSLT_MATH_NAMESPACE
#define EXSLT_SETS_NAMESPACE
#define EXSLT_STRINGS_NAMESPACE
#define SAXON_NAMESPACE
void	exsltCommonRegister		(void)
void	exsltDateRegister		(void)
void	exsltDynRegister		(void)
void	exsltFuncRegister		(void)
diff --git a/doc/EXSLT/html/libexslt-exsltexports.html b/doc/EXSLT/html/libexslt-exsltexports.html index dd4bc81c..698400a6 100644 --- a/doc/EXSLT/html/libexslt-exsltexports.html +++ b/doc/EXSLT/html/libexslt-exsltexports.html @@ -7,7 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } - Module exsltexports from libexslt
Action against software patentsGnome2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The EXSLT C library for Gnome

Module exsltexports from libexslt

API Menu
Related links
API Indexes

Table of Contents

#define EXSLTCALL
#define EXSLTPUBFUN
#define EXSLTPUBVAR
#define LIBEXSLT_PUBLIC
#define _REENTRANT

Description

+ Module exsltexports from libexslt
Action against software patentsGnome2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The EXSLT C library for Gnome

Module exsltexports from libexslt

API Menu
Related links
API Indexes

Table of Contents

#define EXSLTCALL
#define EXSLTPUBFUN
#define EXSLTPUBVAR
#define LIBEXSLT_PUBLIC
#define _REENTRANT

Description

Macro: EXSLTCALL

#define EXSLTCALL

Macro: EXSLTPUBFUN

#define EXSLTPUBFUN

Macro: EXSLTPUBVAR

#define EXSLTPUBVAR

diff --git a/doc/EXSLT/html/libexslt-lib.html b/doc/EXSLT/html/libexslt-lib.html index 2b10276e..392bb122 100644 --- a/doc/EXSLT/html/libexslt-lib.html +++ b/doc/EXSLT/html/libexslt-lib.html @@ -7,4 +7,4 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } - Reference Manual for libexslt
Action against software patentsGnome2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The EXSLT C library for Gnome

Reference Manual for libexslt

API Menu
Related links
API Indexes

Table of Contents

Daniel Veillard

+ Reference Manual for libexslt
Action against software patentsGnome2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The EXSLT C library for Gnome

Reference Manual for libexslt

API Menu
Related links
API Indexes

Table of Contents

Daniel Veillard

diff --git a/doc/EXSLT/libexslt-api.xml b/doc/EXSLT/libexslt-api.xml index 827ee21c..1160cebc 100644 --- a/doc/EXSLT/libexslt-api.xml +++ b/doc/EXSLT/libexslt-api.xml @@ -2,13 +2,13 @@ - - + + + - @@ -16,13 +16,13 @@ - - + - + - + + diff --git a/doc/libxslt-api.xml b/doc/libxslt-api.xml index 5dd1dba3..b6f619f8 100644 --- a/doc/libxslt-api.xml +++ b/doc/libxslt-api.xml @@ -14,57 +14,57 @@ interface for the document handling implements document loading and cache (multiple document() reference for the same resources must be equal. Daniel Veillard - - - + + + interface for the extension support This provide the API needed for simple and module extension support. Daniel Veillard - - + + + + + + + + + + + + + + + + + + + - - - + - - - - - + - - - - - + - - - - - - - + - interface for the non-standard features @@ -86,10 +86,10 @@ Daniel Veillard and Bjorn Reese <breese@users.sourceforge.net> - - + + @@ -102,12 +102,12 @@ Daniel Veillard - - - + + + interface for the key matching used in key() and template matches. @@ -125,11 +125,11 @@ set of function easing the processing and generation of namespace nodes in XSLT. Daniel Veillard - - - + + + Implementation of the XSLT number functions @@ -151,12 +151,12 @@ - - - + + + precomputing stylesheets @@ -197,11 +197,11 @@ This set of routine encapsulates XPath calls and Attribute Value Templates evaluation. Daniel Veillard - + - + @@ -213,33 +213,33 @@ This module implements the bulk of the actual Daniel Veillard - - - - - - - - + - - - + + + + + + + + + + + - @@ -252,12 +252,12 @@ - + - + @@ -285,39 +285,39 @@ Daniel Veillard - - - + + + - - - - + + + + + + + + + + + - - - - - - - @@ -340,41 +340,41 @@ - + + - - - - - - + + + + + + + + + + - - - - - - + macros for marking symbols as exportable/importable. @@ -392,39 +392,39 @@ Daniel Veillard - - - - + + + - - - - - - - - - + + + + + + + + + + + + - - @@ -433,43 +433,43 @@ - - - - - - - - - + - - + - - - + + + + + + + + + + + + diff --git a/libxslt/preproc.c b/libxslt/preproc.c index 779dc2ae..20f1cce5 100644 --- a/libxslt/preproc.c +++ b/libxslt/preproc.c @@ -632,7 +632,7 @@ xsltWithParamComp(xsltStylesheetPtr style, xmlNodePtr inst) { } else { const xmlChar *URI; - URI = xsltGetQNameURI(inst, (xmlChar **)&prop); + URI = xsltGetQNameURI2(style, inst, &prop); if (prop == NULL) { if (style != NULL) style->errors++; } else { @@ -821,14 +821,14 @@ xsltCallTemplateComp(xsltStylesheetPtr style, xmlNodePtr inst) { } else { const xmlChar *URI; - URI = xsltGetQNameURI(inst, (xmlChar **)&prop); + URI = xsltGetQNameURI2(style, inst, &prop); if (prop == NULL) { if (style != NULL) style->errors++; } else { comp->name = prop; comp->has_name = 1; if (URI != NULL) { - comp->ns = xmlStrdup(URI); + comp->ns = URI; comp->has_ns = 1; } else { comp->has_ns = 0; @@ -865,7 +865,7 @@ xsltApplyTemplatesComp(xsltStylesheetPtr style, xmlNodePtr inst) { if (prop != NULL) { const xmlChar *URI; - URI = xsltGetQNameURI(inst, (xmlChar **)&prop); + URI = xsltGetQNameURI2(style, inst, &prop); if (prop == NULL) { if (style != NULL) style->errors++; } else { @@ -1050,7 +1050,7 @@ xsltVariableComp(xsltStylesheetPtr style, xmlNodePtr inst) { } else { const xmlChar *URI; - URI = xsltGetQNameURI(inst, (xmlChar **)&prop); + URI = xsltGetQNameURI2(style, inst, &prop); if (prop == NULL) { if (style != NULL) style->errors++; } else { @@ -1114,7 +1114,7 @@ xsltParamComp(xsltStylesheetPtr style, xmlNodePtr inst) { } else { const xmlChar *URI; - URI = xsltGetQNameURI(inst, (xmlChar **)&prop); + URI = xsltGetQNameURI2(style, inst, &prop); if (prop == NULL) { if (style != NULL) style->errors++; } else { diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c index 53ac087a..3ea4a1ef 100644 --- a/libxslt/xsltutils.c +++ b/libxslt/xsltutils.c @@ -92,8 +92,7 @@ xsltGetCNsProp(xsltStylesheetPtr style, xmlNodePtr node, prop = node->properties; if (nameSpace == NULL) { - tmp = xmlGetProp(node, name); - goto found; + return xmlGetProp(node, name); } while (prop != NULL) { /* @@ -108,11 +107,17 @@ xsltGetCNsProp(xsltStylesheetPtr style, xmlNodePtr node, (xmlStrEqual(prop->ns->href, nameSpace))))) { tmp = xmlNodeListGetString(node->doc, prop->children, 1); - goto found; + if (tmp == NULL) + ret = xmlDictLookup(style->dict, BAD_CAST "", 0); + else { + ret = xmlDictLookup(style->dict, tmp, -1); + xmlFree(tmp); + } + return ret; } prop = prop->next; } - + tmp = NULL; /* * Check if there is a default declaration in the internal * or external subsets @@ -138,14 +143,6 @@ xsltGetCNsProp(xsltStylesheetPtr style, xmlNodePtr node, } } return(NULL); -found: - if (tmp == NULL) - ret = xmlDictLookup(style->dict, BAD_CAST "", 0); - else { - ret = xmlDictLookup(style->dict, tmp, -1); - xmlFree(tmp); - } - return(ret); } /** * xsltGetNsProp: @@ -700,6 +697,74 @@ xsltGetQNameURI(xmlNodePtr node, xmlChar ** name) return(ns->href); } +/** + * xsltGetQNameURI2: + * @style: stylesheet pointer + * @node: the node holding the QName + * @name: pointer to the initial QName value + * + * This function is similar to xsltGetQNameURI, but is used when + * @name is a dictionary entry. + * + * Returns the namespace URI if there is a prefix, or NULL if @name is + * not prefixed. + */ +const xmlChar * +xsltGetQNameURI2(xsltStylesheetPtr style, xmlNodePtr node, + const xmlChar **name) { + int len = 0; + xmlChar *qname; + xmlNsPtr ns; + + if (name == NULL) + return(NULL); + qname = (xmlChar *)*name; + if ((qname == NULL) || (*qname == 0)) + return(NULL); + if (node == NULL) { + xsltGenericError(xsltGenericErrorContext, + "QName: no element for namespace lookup %s\n", + qname); + *name = NULL; + return(NULL); + } + + /* + * we are not trying to validate but just to cut, and yes it will + * work even if this is a set of UTF-8 encoded chars + */ + while ((qname[len] != 0) && (qname[len] != ':')) + len++; + + if (qname[len] == 0) + return(NULL); + + /* + * handle xml: separately, this one is magical + */ + if ((qname[0] == 'x') && (qname[1] == 'm') && + (qname[2] == 'l') && (qname[3] == ':')) { + if (qname[4] == 0) + return(NULL); + *name = xmlDictLookup(style->dict, &qname[4], -1); + return(XML_XML_NAMESPACE); + } + + qname = xmlStrndup(*name, len); + ns = xmlSearchNs(node->doc, node, qname); + if (ns == NULL) { + xsltGenericError(xsltGenericErrorContext, + "%s : no namespace bound to prefix %s\n", + *name, qname); + *name = NULL; + xmlFree(qname); + return(NULL); + } + *name = xmlDictLookup(style->dict, (*name)+len, -1); + xmlFree(qname); + return(ns->href); +} + /************************************************************************ * * * Sorting * diff --git a/libxslt/xsltutils.h b/libxslt/xsltutils.h index d1f0cfe2..5d8e7927 100644 --- a/libxslt/xsltutils.h +++ b/libxslt/xsltutils.h @@ -207,6 +207,11 @@ XSLTPUBFUN const xmlChar * XSLTCALL xsltGetQNameURI (xmlNodePtr node, xmlChar **name); +XSLTPUBFUN const xmlChar * XSLTCALL + xsltGetQNameURI2 (xsltStylesheetPtr style, + xmlNodePtr node, + const xmlChar **name); + /* * Output, reuse libxml I/O buffers. */ -- cgit v1.2.3