diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2002-04-15 15:30:21 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2002-04-15 15:30:21 +0000 |
commit | 6ca5fcf67bafcee7191d074b5449fa0a88514608 (patch) | |
tree | b7cf2b25be83daca4c59955f0182cc2887bc6d6e | |
parent | 00ce7dd8145168d1bfb75a5b0e41e6d288239d0d (diff) | |
download | libxslt-6ca5fcf67bafcee7191d074b5449fa0a88514608.tar.gz libxslt-6ca5fcf67bafcee7191d074b5449fa0a88514608.tar.bz2 libxslt-6ca5fcf67bafcee7191d074b5449fa0a88514608.zip |
removed a warning added xsltRunStylesheetUser() API needed to fix #78546
* libxslt/attributes.c: removed a warning
* libxslt/transform.c libxslt/transform.h win32/libxslt.def.src:
added xsltRunStylesheetUser() API needed to fix #78546
* xsltproc/xsltproc.c: second part of the fix #78546
Daniel
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | libxslt/attributes.c | 2 | ||||
-rw-r--r-- | libxslt/transform.c | 45 | ||||
-rw-r--r-- | libxslt/transform.h | 8 | ||||
-rw-r--r-- | win32/libxslt.def.src | 1 | ||||
-rw-r--r-- | xsltproc/xsltproc.c | 16 |
6 files changed, 73 insertions, 6 deletions
@@ -1,3 +1,10 @@ +Mon Apr 15 17:27:51 CEST 2002 Daniel Veillard <daniel@veillard.com> + + * libxslt/attributes.c: removed a warning + * libxslt/transform.c libxslt/transform.h win32/libxslt.def.src: + added xsltRunStylesheetUser() API needed to fix #78546 + * xsltproc/xsltproc.c: second part of the fix #78546 + Mon Apr 15 15:57:28 CEST 2002 Daniel Veillard <daniel@veillard.com> * python/Makefile.am: fixing the equivalent of #75779 diff --git a/libxslt/attributes.c b/libxslt/attributes.c index ce295d57..b1c6b751 100644 --- a/libxslt/attributes.c +++ b/libxslt/attributes.c @@ -439,7 +439,7 @@ xsltGetSAS(xsltStylesheetPtr style, const xmlChar *name, const xmlChar *ns) { static void xsltResolveSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style, const xmlChar *name, const xmlChar *ns, - const xmlChar *ignored) { + ATTRIBUTE_UNUSED const xmlChar *ignored) { xsltAttrElemPtr tmp; xsltAttrElemPtr refs; diff --git a/libxslt/transform.c b/libxslt/transform.c index 85210c75..38c5e401 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -3700,13 +3700,15 @@ xsltApplyStylesheetUser(xsltStylesheetPtr style, xmlDocPtr doc, } /** - * xsltRunStylesheet: + * xsltRunStylesheetUser: * @style: a parsed XSLT stylesheet * @doc: a parsed XML document * @params: a NULL terminated arry of parameters names/values tuples * @output: the URL/filename ot the generated resource if available * @SAX: a SAX handler for progressive callback output (not implemented yet) * @IObuf: an output buffer for progressive output (not implemented yet) + * @profile: profile FILE * output or NULL + * @userCtxt: user provided transform context * * Apply the stylesheet to the document and generate the output according * to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf. @@ -3724,9 +3726,10 @@ xsltApplyStylesheetUser(xsltStylesheetPtr style, xmlDocPtr doc, * error. */ int -xsltRunStylesheet(xsltStylesheetPtr style, xmlDocPtr doc, +xsltRunStylesheetUser(xsltStylesheetPtr style, xmlDocPtr doc, const char **params, const char *output, - xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf) + xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf, + FILE * profile, xsltTransformContextPtr userCtxt) { xmlDocPtr tmp; int ret; @@ -3742,7 +3745,8 @@ xsltRunStylesheet(xsltStylesheetPtr style, xmlDocPtr doc, return (-1); } - tmp = xsltApplyStylesheetInternal(style, doc, params, output, NULL, NULL); + tmp = xsltApplyStylesheetInternal(style, doc, params, output, profile, + userCtxt); if (tmp == NULL) { xsltPrintErrorContext(NULL, NULL, (xmlNodePtr) doc); xsltGenericError(xsltGenericErrorContext, @@ -3760,6 +3764,39 @@ xsltRunStylesheet(xsltStylesheetPtr style, xmlDocPtr doc, } /** + * xsltRunStylesheet: + * @style: a parsed XSLT stylesheet + * @doc: a parsed XML document + * @params: a NULL terminated arry of parameters names/values tuples + * @output: the URL/filename ot the generated resource if available + * @SAX: a SAX handler for progressive callback output (not implemented yet) + * @IObuf: an output buffer for progressive output (not implemented yet) + * + * Apply the stylesheet to the document and generate the output according + * to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf. + * + * NOTE: This may lead to a non-wellformed output XML wise ! + * NOTE: This may also result in multiple files being generated + * NOTE: using IObuf, the result encoding used will be the one used for + * creating the output buffer, use the following macro to read it + * from the stylesheet + * XSLT_GET_IMPORT_PTR(encoding, style, encoding) + * NOTE: using SAX, any encoding specified in the stylesheet will be lost + * since the interface uses only UTF8 + * + * Returns the number of by written to the main resource or -1 in case of + * error. + */ +int +xsltRunStylesheet(xsltStylesheetPtr style, xmlDocPtr doc, + const char **params, const char *output, + xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf) +{ + return(xsltRunStylesheetUser(style, doc, params, output, SAX, IObuf, + NULL, NULL)); +} + +/** * xsltRegisterAllElement: * @ctxt: the XPath context * diff --git a/libxslt/transform.h b/libxslt/transform.h index 7223bd6d..c94eda66 100644 --- a/libxslt/transform.h +++ b/libxslt/transform.h @@ -60,6 +60,14 @@ int xsltRunStylesheet (xsltStylesheetPtr style, const char *output, xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf); +int xsltRunStylesheetUser (xsltStylesheetPtr style, + xmlDocPtr doc, + const char **params, + const char *output, + xmlSAXHandlerPtr SAX, + xmlOutputBufferPtr IObuf, + FILE * profile, + xsltTransformContextPtr userCtxt); void xsltApplyOneTemplate (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr list, diff --git a/win32/libxslt.def.src b/win32/libxslt.def.src index a7acba2a..5687cc53 100644 --- a/win32/libxslt.def.src +++ b/win32/libxslt.def.src @@ -200,6 +200,7 @@ EXPORTS xsltApplyStylesheet xsltProfileStylesheet xsltRunStylesheet + xsltRunStylesheetUser xsltApplyOneTemplate xsltDocumentElem xsltSort diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c index 23660b1f..af65d486 100644 --- a/xsltproc/xsltproc.c +++ b/xsltproc/xsltproc.c @@ -331,7 +331,21 @@ xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename) { xmlFreeDoc(res); } else { - xsltRunStylesheet(cur, doc, params, output, NULL, NULL); + int ret; + + ctxt = xsltNewTransformContext(cur, doc); + if (ctxt == NULL) + return; + if (profile) { + ret = xsltRunStylesheetUser(cur, doc, params, output, + NULL, NULL, stderr, ctxt); + } else { + ret = xsltRunStylesheetUser(cur, doc, params, output, + NULL, NULL, NULL, ctxt); + } + if (ctxt->state == XSLT_STATE_ERROR) + errorno = 9; + xsltFreeTransformContext(ctxt); if (timing) endTimer("Running stylesheet and saving result"); xmlFreeDoc(doc); |