+Thu Feb 1 20:58:54 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * libxslt/Makefile.am libxslt/imports.[ch]: new module to
+ implement import cascade lookups and traversal
+ * libxslt/attributes.c libxslt/namespaces.c libxslt/pattern.[ch]
+ libxslt/transform.c libxslt/xslt.c libxslt/xsltInternals.h:
+ started coding the import cascade lookup in the places needed,
+ probably incomplete.
+
Thu Feb 1 18:04:39 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* libxslt/xsltInternals.h libxslt/xslt.h: started implementing
variables.h \
functions.h \
namespaces.h \
+ imports.h \
attributes.h \
transform.h \
xsltInternals.h
variables.c \
functions.c \
namespaces.c \
+ imports.c \
attributes.c \
transform.c
#include "attributes.h"
#include "namespaces.h"
#include "templates.h"
+#include "imports.h"
+
+/*
+ * TODO: merge attribute sets from different import precedence.
+ * all this should be precomputed just before the transformation
+ * starts or at first hit with a cache in the context.
+ * The simple way for now would be to not allow redefinition of
+ * attributes once generated in the output tree, possibly costlier.
+ */
/*
* Useful macros
xmlChar *prefix = NULL;
xmlChar *attribute, *end;
xsltAttrElemPtr values;
+ xsltStylesheetPtr style;
if (attributes == NULL) {
return;
prefix = NULL;
}
- /* TODO: apply cascade */
- values = xmlHashLookup2(ctxt->style->attributeSets, ncname, prefix);
- while (values != NULL) {
- xsltAttribute(ctxt, node, values->attr);
- values = values->next;
+ style = ctxt->style;
+ while (style != NULL) {
+ values = xmlHashLookup2(style->attributeSets, ncname, prefix);
+ while (values != NULL) {
+ xsltAttribute(ctxt, node, values->attr);
+ values = values->next;
+ }
+ style = xsltNextImport(style);
}
if (attribute != NULL)
xmlFree(attribute);
--- /dev/null
+/*
+ * imports.c: Implementation of the XSLT imports
+ *
+ * Reference:
+ * http://www.w3.org/TR/1999/REC-xslt-19991116
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@imag.fr
+ */
+
+#include "xsltconfig.h"
+
+#include <string.h>
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+#ifdef HAVE_FLOAT_H
+#include <float.h>
+#endif
+#ifdef HAVE_IEEEFP_H
+#include <ieeefp.h>
+#endif
+#ifdef HAVE_NAN_H
+#include <nan.h>
+#endif
+#ifdef HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+
+#include <libxml/xmlmemory.h>
+#include <libxml/tree.h>
+#include <libxml/hash.h>
+#include <libxml/xmlerror.h>
+#include <libxml/uri.h>
+#include "xslt.h"
+#include "xsltInternals.h"
+#include "xsltutils.h"
+#include "imports.h"
+
+
+
+/************************************************************************
+ * *
+ * Module interfaces *
+ * *
+ ************************************************************************/
+
+/**
+ * xsltParseStylesheetImport:
+ * @style: the XSLT stylesheet
+ * @template: the "strip-space" element
+ *
+ * parse an XSLT stylesheet strip-space element and record
+ * elements needing stripping
+ */
+
+void
+xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur) {
+ xmlDocPtr import = NULL;
+ xmlChar *base = NULL;
+ xmlChar *uriRef = NULL;
+ xmlChar *URI = NULL;
+ xsltStylesheetPtr res;
+
+ if ((cur == NULL) || (style == NULL))
+ return;
+
+ uriRef = xmlGetNsProp(cur, (const xmlChar *)"href", XSLT_NAMESPACE);
+ if (uriRef == NULL) {
+ xsltGenericError(xsltGenericErrorContext,
+ "xsl:import : missing href attribute\n");
+ goto error;
+ }
+
+ base = xmlNodeGetBase(style->doc, cur);
+ URI = xmlBuildURI(uriRef, base);
+ if (URI == NULL) {
+ xsltGenericError(xsltGenericErrorContext,
+ "xsl:import : invalid URI reference %s\n", uriRef);
+ goto error;
+ }
+ import = xmlParseFile((const char *)URI);
+ if (import == NULL) {
+ xsltGenericError(xsltGenericErrorContext,
+ "xsl:import : unable to load %s\n", URI);
+ goto error;
+ }
+
+ res = xsltParseStylesheetDoc(import);
+ if (res != NULL) {
+ res->parent = style;
+ res->next = style->imports;
+ style->imports = res;
+ }
+
+error:
+ if (import != NULL)
+ xmlFreeDoc(import);
+ if (uriRef != NULL)
+ xmlFree(uriRef);
+ if (base != NULL)
+ xmlFree(base);
+ if (URI != NULL)
+ xmlFree(URI);
+}
+
+/**
+ * xsltParseStylesheetInclude:
+ * @style: the XSLT stylesheet
+ * @template: the "strip-space" element
+ *
+ * parse an XSLT stylesheet strip-space element and record
+ * elements needing stripping
+ */
+
+void
+xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) {
+ xmlDocPtr include = NULL, oldDoc;
+ xmlChar *base = NULL;
+ xmlChar *uriRef = NULL;
+ xmlChar *URI = NULL;
+
+ if ((cur == NULL) || (style == NULL))
+ return;
+
+ uriRef = xmlGetNsProp(cur, (const xmlChar *)"href", XSLT_NAMESPACE);
+ if (uriRef == NULL) {
+ xsltGenericError(xsltGenericErrorContext,
+ "xsl:include : missing href attribute\n");
+ goto error;
+ }
+
+ base = xmlNodeGetBase(style->doc, cur);
+ URI = xmlBuildURI(uriRef, base);
+ if (URI == NULL) {
+ xsltGenericError(xsltGenericErrorContext,
+ "xsl:include : invalid URI reference %s\n", uriRef);
+ goto error;
+ }
+ include = xmlParseFile((const char *)URI);
+ if (include == NULL) {
+ xsltGenericError(xsltGenericErrorContext,
+ "xsl:include : unable to load %s\n", URI);
+ goto error;
+ }
+
+ oldDoc = style->doc;
+ style->doc = include;
+ xsltParseStylesheetProcess(style, include);
+ style->doc = oldDoc;
+
+error:
+ if (include != NULL)
+ xmlFreeDoc(include);
+ if (uriRef != NULL)
+ xmlFree(uriRef);
+ if (base != NULL)
+ xmlFree(base);
+ if (URI != NULL)
+ xmlFree(URI);
+}
+
+/**
+ * xsltNextImport:
+ * @cur: the current XSLT stylesheet
+ *
+ * Find the next stylesheet in import precedence.
+ *
+ * Returns the next stylesheet or NULL if it was the last one
+ */
+
+xsltStylesheetPtr
+xsltNextImport(xsltStylesheetPtr cur) {
+ if (cur == NULL)
+ return(NULL);
+ if (cur->imports != NULL)
+ return(cur->imports);
+ if (cur->next != NULL)
+ return(cur->next) ;
+ do {
+ cur = cur->parent;
+ if (cur == NULL) return(NULL);
+ if (cur->next != NULL) return(cur->next);
+ } while (cur != NULL);
+ return(cur);
+}
+
+/**
+ * xsltFindElemSpaceHandling:
+ * ctxt: an XSLT transformation context
+ * node: an XML node
+ *
+ * Find strip-space or preserve-space informations for an element
+ * respect the import precedence or the wildcards
+ *
+ * Returns 1 if space should be stripped, 0 if not, and 2 if everything
+ * should be CDTATA wrapped.
+ */
+
+int
+xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, xmlNodePtr node) {
+ xsltStylesheetPtr style;
+ const xmlChar *val;
+
+ if ((ctxt == NULL) || (node == NULL))
+ return(0);
+ style = ctxt->style;
+ while (style != NULL) {
+ /* TODO: add namespaces support */
+ val = (const xmlChar *)
+ xmlHashLookup(style->stripSpaces, node->name);
+ if (val != NULL) {
+ if (xmlStrEqual(val, (xmlChar *) "strip"))
+ return(1);
+ if (xmlStrEqual(val, (xmlChar *) "preserve"))
+ return(0);
+ }
+ val = (const xmlChar *)
+ xmlHashLookup(ctxt->style->stripSpaces,
+ (const xmlChar *)"*");
+ if ((val != NULL) &&
+ (xmlStrEqual(val, (xmlChar *) "strip")))
+ return(1);
+ if (xmlStrEqual(val, (xmlChar *) "preserve"))
+ return(0);
+
+ style = xsltNextImport(style);
+ }
+ return(0);
+}
+
+/**
+ * xsltFindTemplate:
+ * ctxt: an XSLT transformation context
+ * @name: the template name
+ * @nameURI: the template name URI
+ *
+ * Finds the named template, apply import precedence rule.
+ *
+ * Returns the xsltTemplatePtr or NULL if not found
+ */
+xsltTemplatePtr
+xsltFindTemplate(xsltTransformContextPtr ctxt, const xmlChar *name,
+ const xmlChar *nameURI) {
+ xsltTemplatePtr cur;
+ xsltStylesheetPtr style;
+
+ if ((ctxt == NULL) || (name == NULL))
+ return(NULL);
+ style = ctxt->style;
+ while (style != NULL) {
+ cur = style->templates;
+ while (cur != NULL) {
+ if (xmlStrEqual(name, cur->name)) {
+ if (((nameURI == NULL) && (cur->nameURI == NULL)) ||
+ ((nameURI != NULL) && (cur->nameURI != NULL) &&
+ (xmlStrEqual(nameURI, cur->nameURI)))) {
+ return(cur);
+ }
+ }
+ cur = cur->next;
+ }
+
+ style = xsltNextImport(style);
+ }
+ return(NULL);
+}
+
--- /dev/null
+/*
+ * imports.h: interface for the XSLT import support
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@imag.fr
+ */
+
+#ifndef __XML_XSLT_IMPORTS_H__
+#define __XML_XSLT_IMPORTS_H__
+
+#include <libxml/tree.h>
+#include "xsltInternals.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void xsltParseStylesheetImport(xsltStylesheetPtr style,
+ xmlNodePtr cur);
+void xsltParseStylesheetInclude(xsltStylesheetPtr style,
+ xmlNodePtr cur);
+xsltStylesheetPtr xsltNextImport (xsltStylesheetPtr style);
+int xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt,
+ xmlNodePtr node);
+xsltTemplatePtr xsltFindTemplate (xsltTransformContextPtr ctxt,
+ const xmlChar *name,
+ const xmlChar *nameURI);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLT_IMPORTS_H__ */
+
#include "xsltInternals.h"
#include "xsltutils.h"
#include "namespaces.h"
+#include "imports.h"
xmlNsPtr
xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns,
xmlNodePtr out) {
+ xsltStylesheetPtr style;
xmlNsPtr ret;
- const xmlChar *URI;
+ const xmlChar *URI = NULL; /* the replacement URI */
if ((ctxt == NULL) || (cur == NULL) || (out == NULL) || (ns == NULL))
return(NULL);
- /* TODO apply cascading */
- if (ctxt->style->nsAliases != NULL) {
- URI = (const xmlChar *) xmlHashLookup(ctxt->style->nsAliases, ns->href);
- if (URI == NULL)
- URI = ns->href;
- } else
+ style = ctxt->style;
+ while (style != NULL) {
+ if (style->nsAliases != NULL)
+ URI = (const xmlChar *)
+ xmlHashLookup(ctxt->style->nsAliases, ns->href);
+ if (URI != NULL)
+ break;
+
+ style = xsltNextImport(style);
+ }
+
+ if (URI == NULL)
URI = ns->href;
if ((out->parent != NULL) &&
#include "xslt.h"
#include "xsltInternals.h"
#include "xsltutils.h"
+#include "imports.h"
/* #define DEBUG_PARSING */
/**
* xsltGetTemplate:
- * @style: an XSLT stylesheet
+ * @ctxt: a XSLT process context
* @node: an XML Node
*
* Finds the template applying to this node
* Returns the xsltTemplatePtr or NULL if not found
*/
xsltTemplatePtr
-xsltGetTemplate(xsltStylesheetPtr style, xmlNodePtr node) {
+xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node) {
+ xsltStylesheetPtr style;
xsltTemplatePtr ret = NULL;
const xmlChar *name = NULL;
xsltCompMatchPtr list = NULL;
- if ((style == NULL) || (node == NULL))
+ if ((ctxt == NULL) || (node == NULL))
return(NULL);
- /* TODO : handle IDs/keys here ! */
- if (style->templatesHash != NULL) {
+ style = ctxt->style;
+ while (style != NULL) {
+ /* TODO : handle IDs/keys here ! */
+ if (style->templatesHash != NULL) {
+ /*
+ * Use the top name as selector
+ */
+ switch (node->type) {
+ case XML_ELEMENT_NODE:
+ case XML_ATTRIBUTE_NODE:
+ case XML_PI_NODE:
+ name = node->name;
+ break;
+ case XML_DOCUMENT_NODE:
+ case XML_HTML_DOCUMENT_NODE:
+ case XML_TEXT_NODE:
+ case XML_CDATA_SECTION_NODE:
+ case XML_COMMENT_NODE:
+ case XML_ENTITY_REF_NODE:
+ case XML_ENTITY_NODE:
+ case XML_DOCUMENT_TYPE_NODE:
+ case XML_DOCUMENT_FRAG_NODE:
+ case XML_NOTATION_NODE:
+ case XML_DTD_NODE:
+ case XML_ELEMENT_DECL:
+ case XML_ATTRIBUTE_DECL:
+ case XML_ENTITY_DECL:
+ case XML_NAMESPACE_DECL:
+ case XML_XINCLUDE_START:
+ case XML_XINCLUDE_END:
+ break;
+ default:
+ return(NULL);
+
+ }
+ }
+ if (name != NULL) {
+ /*
+ * find the list of appliable expressions based on the name
+ */
+ list = (xsltCompMatchPtr) xmlHashLookup(style->templatesHash, name);
+ }
+ while (list != NULL) {
+ if (xsltTestCompMatch(list, node)) {
+ ret = list->template;
+ break;
+ }
+ list = list->next;
+ }
+ list = NULL;
+
/*
- * Use the top name as selector
+ * find alternate generic matches
*/
switch (node->type) {
case XML_ELEMENT_NODE:
+ list = style->elemMatch;
+ break;
case XML_ATTRIBUTE_NODE:
+ list = style->attrMatch;
+ break;
case XML_PI_NODE:
- name = node->name;
+ list = style->piMatch;
break;
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
+ list = style->rootMatch;
+ break;
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
+ list = style->textMatch;
+ break;
case XML_COMMENT_NODE:
+ list = style->commentMatch;
+ break;
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_XINCLUDE_END:
break;
default:
- return(NULL);
+ break;
}
- }
- if (name != NULL) {
- /*
- * find the list of appliable expressions based on the name
- */
- list = (xsltCompMatchPtr) xmlHashLookup(style->templatesHash, name);
- }
- while (list != NULL) {
- if (xsltTestCompMatch(list, node)) {
- ret = list->template;
- break;
+ while ((list != NULL) &&
+ ((ret == NULL) || (list->priority > ret->priority))) {
+ if (xsltTestCompMatch(list, node)) {
+ ret = list->template;
+ break;
+ }
}
- list = list->next;
- }
- list = NULL;
+ if (ret != NULL)
+ return(ret);
- /*
- * find alternate generic matches
- */
- switch (node->type) {
- case XML_ELEMENT_NODE:
- list = style->elemMatch;
- break;
- case XML_ATTRIBUTE_NODE:
- list = style->attrMatch;
- break;
- case XML_PI_NODE:
- list = style->piMatch;
- break;
- case XML_DOCUMENT_NODE:
- case XML_HTML_DOCUMENT_NODE:
- list = style->rootMatch;
- break;
- case XML_TEXT_NODE:
- case XML_CDATA_SECTION_NODE:
- list = style->textMatch;
- break;
- case XML_COMMENT_NODE:
- list = style->commentMatch;
- break;
- case XML_ENTITY_REF_NODE:
- case XML_ENTITY_NODE:
- case XML_DOCUMENT_TYPE_NODE:
- case XML_DOCUMENT_FRAG_NODE:
- case XML_NOTATION_NODE:
- case XML_DTD_NODE:
- case XML_ELEMENT_DECL:
- case XML_ATTRIBUTE_DECL:
- case XML_ENTITY_DECL:
- case XML_NAMESPACE_DECL:
- case XML_XINCLUDE_START:
- case XML_XINCLUDE_END:
- break;
- default:
- break;
-
- }
- while ((list != NULL) &&
- ((ret == NULL) || (list->priority > ret->priority))) {
- if (xsltTestCompMatch(list, node)) {
- ret = list->template;
- break;
- }
+ /*
+ * Cycle on next stylesheet import.
+ */
+ style = xsltNextImport(style);
}
- return(ret);
+ return(NULL);
}
xsltFreeCompMatchList(style->commentMatch);
}
-/**
- * xsltFindTemplate:
- * @style: an XSLT stylesheet
- * @name: the template name
- * @nameURI: the template name URI
- *
- * Finds the named template.
- *
- * Returns the xsltTemplatePtr or NULL if not found
- */
-xsltTemplatePtr
-xsltFindTemplate(xsltStylesheetPtr style, const xmlChar *name,
- const xmlChar *nameURI) {
- xsltTemplatePtr cur;
-
- if ((style == NULL) || (name == NULL))
- return(NULL);
-
- /* TODO: apply stylesheet import order */
- cur = style->templates;
- while (cur != NULL) {
- if (xmlStrEqual(name, cur->name)) {
- if (((nameURI == NULL) && (cur->nameURI == NULL)) ||
- ((nameURI != NULL) && (cur->nameURI != NULL) &&
- (xmlStrEqual(nameURI, cur->nameURI)))) {
- return(cur);
- }
- }
- cur = cur->next;
- }
- return(NULL);
-}
-
int xsltAddTemplate (xsltStylesheetPtr style,
xsltTemplatePtr cur);
-xsltTemplatePtr xsltGetTemplate (xsltStylesheetPtr style,
+xsltTemplatePtr xsltGetTemplate (xsltTransformContextPtr ctxt,
xmlNodePtr node);
void xsltFreeTemplateHashes (xsltStylesheetPtr style);
-xsltTemplatePtr xsltFindTemplate (xsltStylesheetPtr style,
- const xmlChar *name,
- const xmlChar *nameURI);
#ifdef __cplusplus
}
#endif
#include "namespaces.h"
#include "attributes.h"
#include "templates.h"
+#include "imports.h"
#define DEBUG_PROCESS
if ((IS_BLANK_NODE(cur)) &&
(cur->parent != NULL) &&
(ctxt->style->stripSpaces != NULL)) {
- const xmlChar *val;
-
- if (strip_spaces == -1) {
- /* TODO: add namespaces support */
- val = (const xmlChar *)
- xmlHashLookup(ctxt->style->stripSpaces,
- cur->parent->name);
- if (val != NULL) {
- if (xmlStrEqual(val, (xmlChar *) "strip"))
- strip_spaces = 1;
- if (xmlStrEqual(val, (xmlChar *) "preserve"))
- strip_spaces = 0;
- }
- if (strip_spaces == -1) {
- val = (const xmlChar *)
- xmlHashLookup(ctxt->style->stripSpaces,
- (const xmlChar *)"*");
- if ((val != NULL) &&
- (xmlStrEqual(val, (xmlChar *) "strip")))
- strip_spaces = 1;
- else
- strip_spaces = 0;
- }
- }
+ if (strip_spaces == -1)
+ strip_spaces =
+ xsltFindElemSpaceHandling(ctxt, cur->parent);
if (strip_spaces == 1) {
delete = cur;
break;
}
}
if (ns != NULL)
- template = xsltFindTemplate(ctxt->style, ncname, ns->href);
+ template = xsltFindTemplate(ctxt, ncname, ns->href);
else
- template = xsltFindTemplate(ctxt->style, ncname, NULL);
+ template = xsltFindTemplate(ctxt, ncname, NULL);
if (template == NULL) {
xsltGenericError(xsltGenericDebugContext,
"xslt:call-template: template %s not found\n", cur->name);
xsltTemplatePtr template;
xmlNodePtr oldNode;
- template = xsltGetTemplate(ctxt->style, node);
+ template = xsltGetTemplate(ctxt, node);
/*
* If no template is found, apply the default rule.
*/
#include "namespaces.h"
#include "attributes.h"
#include "xsltutils.h"
+#include "imports.h"
#define DEBUG_PARSING
#define IS_BLANK_NODE(n) \
(((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
-xsltStylesheetPtr xsltParseStylesheetProcess(xsltStylesheetPtr ret,
- xmlDocPtr doc);
-xsltStylesheetPtr xsltParseStylesheetDoc(xmlDocPtr doc);
/************************************************************************
* *
}
/**
- * xsltParseStylesheetImport:
- * @style: the XSLT stylesheet
- * @template: the "strip-space" element
- *
- * parse an XSLT stylesheet strip-space element and record
- * elements needing stripping
- */
-
-void
-xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur) {
- xmlDocPtr import = NULL;
- xmlChar *base = NULL;
- xmlChar *uriRef = NULL;
- xmlChar *URI = NULL;
- xsltStylesheetPtr res;
-
- if ((cur == NULL) || (style == NULL))
- return;
-
- uriRef = xmlGetNsProp(cur, (const xmlChar *)"href", XSLT_NAMESPACE);
- if (uriRef == NULL) {
- xsltGenericError(xsltGenericErrorContext,
- "xsl:import : missing href attribute\n");
- goto error;
- }
-
- base = xmlNodeGetBase(style->doc, cur);
- URI = xmlBuildURI(uriRef, base);
- if (URI == NULL) {
- xsltGenericError(xsltGenericErrorContext,
- "xsl:import : invalid URI reference %s\n", uriRef);
- goto error;
- }
- import = xmlParseFile((const char *)URI);
- if (import == NULL) {
- xsltGenericError(xsltGenericErrorContext,
- "xsl:import : unable to load %s\n", URI);
- goto error;
- }
-
- res = xsltParseStylesheetDoc(import);
- if (res != NULL) {
- res->parent = style;
- res->next = style->imports;
- style->imports = res;
- }
-
-error:
- if (import != NULL)
- xmlFreeDoc(import);
- if (uriRef != NULL)
- xmlFree(uriRef);
- if (base != NULL)
- xmlFree(base);
- if (URI != NULL)
- xmlFree(URI);
-}
-
-/**
- * xsltParseStylesheetInclude:
- * @style: the XSLT stylesheet
- * @template: the "strip-space" element
- *
- * parse an XSLT stylesheet strip-space element and record
- * elements needing stripping
- */
-
-void
-xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) {
- xmlDocPtr include = NULL, oldDoc;
- xmlChar *base = NULL;
- xmlChar *uriRef = NULL;
- xmlChar *URI = NULL;
-
- if ((cur == NULL) || (style == NULL))
- return;
-
- uriRef = xmlGetNsProp(cur, (const xmlChar *)"href", XSLT_NAMESPACE);
- if (uriRef == NULL) {
- xsltGenericError(xsltGenericErrorContext,
- "xsl:include : missing href attribute\n");
- goto error;
- }
-
- base = xmlNodeGetBase(style->doc, cur);
- URI = xmlBuildURI(uriRef, base);
- if (URI == NULL) {
- xsltGenericError(xsltGenericErrorContext,
- "xsl:include : invalid URI reference %s\n", uriRef);
- goto error;
- }
- include = xmlParseFile((const char *)URI);
- if (include == NULL) {
- xsltGenericError(xsltGenericErrorContext,
- "xsl:include : unable to load %s\n", URI);
- goto error;
- }
-
- oldDoc = style->doc;
- style->doc = include;
- xsltParseStylesheetProcess(style, include);
- style->doc = oldDoc;
-
-error:
- if (include != NULL)
- xmlFreeDoc(include);
- if (uriRef != NULL)
- xmlFree(uriRef);
- if (base != NULL)
- xmlFree(base);
- if (URI != NULL)
- xmlFree(URI);
-}
-
-/**
* xsltParseStylesheetStripSpace:
* @style: the XSLT stylesheet
* @template: the "strip-space" element
int xsltIsBlank (xmlChar *str);
void xsltFreeStackElemList (xsltStackElemPtr elem);
+xsltStylesheetPtr xsltParseStylesheetProcess(xsltStylesheetPtr ret,
+ xmlDocPtr doc);
+xsltStylesheetPtr xsltParseStylesheetDoc (xmlDocPtr doc);
#ifdef __cplusplus
}
#endif