• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Summary: interface for the document handling
3  * Description: implements document loading and cache (multiple
4  *              document() reference for the same resources must
5  *              be equal.
6  *
7  * Copy: See Copyright for the status of this software.
8  *
9  * Author: Daniel Veillard
10  */
11 
12 #ifndef __XML_XSLT_DOCUMENTS_H__
13 #define __XML_XSLT_DOCUMENTS_H__
14 
15 #include <libxml/tree.h>
16 #include "xsltexports.h"
17 #include "xsltInternals.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 XSLTPUBFUN xsltDocumentPtr XSLTCALL
24 		xsltNewDocument		(xsltTransformContextPtr ctxt,
25 					 xmlDocPtr doc);
26 XSLTPUBFUN xsltDocumentPtr XSLTCALL
27     		xsltLoadDocument	(xsltTransformContextPtr ctxt,
28 					 const xmlChar *URI);
29 XSLTPUBFUN xsltDocumentPtr XSLTCALL
30     		xsltFindDocument	(xsltTransformContextPtr ctxt,
31 					 xmlDocPtr doc);
32 XSLTPUBFUN void XSLTCALL
33     		xsltFreeDocuments	(xsltTransformContextPtr ctxt);
34 
35 XSLTPUBFUN xsltDocumentPtr XSLTCALL
36     		xsltLoadStyleDocument	(xsltStylesheetPtr style,
37 					 const xmlChar *URI);
38 XSLTPUBFUN xsltDocumentPtr XSLTCALL
39     		xsltNewStyleDocument	(xsltStylesheetPtr style,
40 					 xmlDocPtr doc);
41 XSLTPUBFUN void XSLTCALL
42     		xsltFreeStyleDocuments	(xsltStylesheetPtr style);
43 
44 /*
45  * Hooks for document loading
46  */
47 
48 /**
49  * xsltLoadType:
50  *
51  * Enum defining the kind of loader requirement.
52  */
53 typedef enum {
54     XSLT_LOAD_START = 0,	/* loading for a top stylesheet */
55     XSLT_LOAD_STYLESHEET = 1,	/* loading for a stylesheet include/import */
56     XSLT_LOAD_DOCUMENT = 2	/* loading document at transformation time */
57 } xsltLoadType;
58 
59 /**
60  * xsltDocLoaderFunc:
61  * @URI: the URI of the document to load
62  * @dict: the dictionary to use when parsing that document
63  * @options: parsing options, a set of xmlParserOption
64  * @ctxt: the context, either a stylesheet or a transformation context
65  * @type: the xsltLoadType indicating the kind of loading required
66  *
67  * An xsltDocLoaderFunc is a signature for a function which can be
68  * registered to load document not provided by the compilation or
69  * transformation API themselve, for example when an xsl:import,
70  * xsl:include is found at compilation time or when a document()
71  * call is made at runtime.
72  *
73  * Returns the pointer to the document (which will be modified and
74  * freed by the engine later), or NULL in case of error.
75  */
76 typedef xmlDocPtr (*xsltDocLoaderFunc)		(const xmlChar *URI,
77 						 xmlDictPtr dict,
78 						 int options,
79 						 void *ctxt,
80 						 xsltLoadType type);
81 
82 XSLTPUBFUN void XSLTCALL
83 		xsltSetLoaderFunc		(xsltDocLoaderFunc f);
84 
85 /* the loader may be needed by extension libraries so it is exported */
86 XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader;
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif /* __XML_XSLT_DOCUMENTS_H__ */
93 
94