ReactOS 0.4.16-dev-336-gb667d82
documents.h File Reference
#include <libxml/tree.h>
#include "xsltexports.h"
#include "xsltInternals.h"
Include dependency graph for documents.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef xmlDocPtr(* xsltDocLoaderFunc) (const xmlChar *URI, xmlDictPtr dict, int options, void *ctxt, xsltLoadType type)
 

Enumerations

enum  xsltLoadType { XSLT_LOAD_START = 0 , XSLT_LOAD_STYLESHEET = 1 , XSLT_LOAD_DOCUMENT = 2 }
 

Functions

XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltNewDocument (xsltTransformContextPtr ctxt, xmlDocPtr doc)
 
XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltLoadDocument (xsltTransformContextPtr ctxt, const xmlChar *URI)
 
XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltFindDocument (xsltTransformContextPtr ctxt, xmlDocPtr doc)
 
XSLTPUBFUN void XSLTCALL xsltFreeDocuments (xsltTransformContextPtr ctxt)
 
XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltLoadStyleDocument (xsltStylesheetPtr style, const xmlChar *URI)
 
XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltNewStyleDocument (xsltStylesheetPtr style, xmlDocPtr doc)
 
XSLTPUBFUN void XSLTCALL xsltFreeStyleDocuments (xsltStylesheetPtr style)
 
XSLTPUBFUN void XSLTCALL xsltSetLoaderFunc (xsltDocLoaderFunc f)
 

Variables

XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader
 

Typedef Documentation

◆ xsltDocLoaderFunc

typedef xmlDocPtr(* xsltDocLoaderFunc) (const xmlChar *URI, xmlDictPtr dict, int options, void *ctxt, xsltLoadType type)

xsltDocLoaderFunc: @URI: the URI of the document to load @dict: the dictionary to use when parsing that document @options: parsing options, a set of xmlParserOption @ctxt: the context, either a stylesheet or a transformation context @type: the xsltLoadType indicating the kind of loading required

An xsltDocLoaderFunc is a signature for a function which can be registered to load document not provided by the compilation or transformation API themselve, for example when an xsl:import, xsl:include is found at compilation time or when a document() call is made at runtime.

Returns the pointer to the document (which will be modified and freed by the engine later), or NULL in case of error.

Definition at line 76 of file documents.h.

Enumeration Type Documentation

◆ xsltLoadType

xsltLoadType:

Enum defining the kind of loader requirement.

Enumerator
XSLT_LOAD_START 
XSLT_LOAD_STYLESHEET 
XSLT_LOAD_DOCUMENT 

Definition at line 53 of file documents.h.

53 {
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 */
xsltLoadType
Definition: documents.h:53
@ XSLT_LOAD_STYLESHEET
Definition: documents.h:55
@ XSLT_LOAD_DOCUMENT
Definition: documents.h:56
@ XSLT_LOAD_START
Definition: documents.h:54

Function Documentation

◆ xsltFindDocument()

xsltFindDocument: @ctxt: an XSLT transformation context @doc: a parsed XML document

Try to find a document within the XSLT transformation context. This will not find document infos for temporary Result Tree Fragments.

Returns the desired xsltDocumentPtr or NULL in case of error

Definition at line 400 of file documents.c.

400 {
402
403 if ((ctxt == NULL) || (doc == NULL))
404 return(NULL);
405
406 /*
407 * Walk the context list to find the document
408 */
409 ret = ctxt->docList;
410 while (ret != NULL) {
411 if (ret->doc == doc)
412 return(ret);
413 ret = ret->next;
414 }
415 if (doc == ctxt->style->doc)
416 return(ctxt->document);
417 return(NULL);
418}
#define NULL
Definition: types.h:112
xsltDocumentPtr document
xsltStylesheetPtr style
xsltDocumentPtr docList
int ret

Referenced by xsltKeyFunction().

◆ xsltFreeDocuments()

XSLTPUBFUN void XSLTCALL xsltFreeDocuments ( xsltTransformContextPtr  ctxt)

xsltFreeDocuments: @ctxt: an XSLT transformation context

Free up all the space used by the loaded documents

Definition at line 234 of file documents.c.

234 {
235 xsltDocumentPtr doc, cur;
236
237 cur = ctxt->docList;
238 while (cur != NULL) {
239 doc = cur;
240 cur = cur->next;
242 if (!doc->main)
243 xmlFreeDoc(doc->doc);
244 xmlFree(doc);
245 }
246 cur = ctxt->styleList;
247 while (cur != NULL) {
248 doc = cur;
249 cur = cur->next;
251 if (!doc->main)
252 xmlFreeDoc(doc->doc);
253 xmlFree(doc);
254 }
255}
FxCollectionEntry * cur
void xsltFreeDocumentKeys(xsltDocumentPtr idoc)
Definition: keys.c:925
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:251
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
xmlDocPtr doc
xsltDocumentPtr styleList

Referenced by xsltFreeTransformContext().

◆ xsltFreeStyleDocuments()

XSLTPUBFUN void XSLTCALL xsltFreeStyleDocuments ( xsltStylesheetPtr  style)

xsltFreeStyleDocuments: @style: an XSLT stylesheet (representing a stylesheet-level)

Frees the node-trees (and xsltDocument structures) of all stylesheet-modules of the stylesheet-level represented by the given @style.

Definition at line 193 of file documents.c.

193 {
194 xsltDocumentPtr doc, cur;
195#ifdef XSLT_REFACTORED_XSLT_NSCOMP
196 xsltNsMapPtr nsMap;
197#endif
198
199 if (style == NULL)
200 return;
201
202#ifdef XSLT_REFACTORED_XSLT_NSCOMP
203 if (XSLT_HAS_INTERNAL_NSMAP(style))
204 nsMap = XSLT_GET_INTERNAL_NSMAP(style);
205 else
206 nsMap = NULL;
207#endif
208
209 cur = style->docList;
210 while (cur != NULL) {
211 doc = cur;
212 cur = cur->next;
213#ifdef XSLT_REFACTORED_XSLT_NSCOMP
214 /*
215 * Restore all changed namespace URIs of ns-decls.
216 */
217 if (nsMap)
218 xsltRestoreDocumentNamespaces(nsMap, doc->doc);
219#endif
221 if (!doc->main)
222 xmlFreeDoc(doc->doc);
223 xmlFree(doc);
224 }
225}
Arabic default style
Definition: afstyles.h:94

Referenced by xsltFreeStylesheet().

◆ xsltLoadDocument()

XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltLoadDocument ( xsltTransformContextPtr  ctxt,
const xmlChar URI 
)

xsltLoadDocument: @ctxt: an XSLT transformation context @URI: the computed URI of the document

Try to load a document (not a stylesheet) within the XSLT transformation context

Returns the new xsltDocumentPtr or NULL in case of error

Definition at line 268 of file documents.c.

268 {
270 xmlDocPtr doc;
271
272 if ((ctxt == NULL) || (URI == NULL))
273 return(NULL);
274
275 /*
276 * Security framework check
277 */
278 if (ctxt->sec != NULL) {
279 int res;
280
281 res = xsltCheckRead(ctxt->sec, ctxt, URI);
282 if (res <= 0) {
283 if (res == 0)
285 "xsltLoadDocument: read rights for %s denied\n",
286 URI);
287 return(NULL);
288 }
289 }
290
291 /*
292 * Walk the context list to find the document if preparsed
293 */
294 ret = ctxt->docList;
295 while (ret != NULL) {
296 if ((ret->doc != NULL) && (ret->doc->URL != NULL) &&
297 (xmlStrEqual(ret->doc->URL, URI)))
298 return(ret);
299 ret = ret->next;
300 }
301
302 doc = xsltDocDefaultLoader(URI, ctxt->dict, ctxt->parserOptions,
303 (void *) ctxt, XSLT_LOAD_DOCUMENT);
304
305 if (doc == NULL)
306 return(NULL);
307
308 if (ctxt->xinclude != 0) {
309#ifdef LIBXML_XINCLUDE_ENABLED
310#if LIBXML_VERSION >= 20603
311 xmlXIncludeProcessFlags(doc, ctxt->parserOptions);
312#else
313 xmlXIncludeProcess(doc);
314#endif
315#else
317 "xsltLoadDocument(%s) : XInclude processing not compiled in\n",
318 URI);
319#endif
320 }
321 /*
322 * Apply white-space stripping if asked for
323 */
326 if (ctxt->debugStatus == XSLT_DEBUG_NONE)
327 xmlXPathOrderDocElems(doc);
328
329 ret = xsltNewDocument(ctxt, doc);
330 return(ret);
331}
int xsltCheckRead(xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const xmlChar *URL)
Definition: security.c:402
void xsltApplyStripSpaces(xsltTransformContextPtr ctxt, xmlNodePtr node)
Definition: transform.c:5609
xsltDocumentPtr xsltNewDocument(xsltTransformContextPtr ctxt, xmlDocPtr doc)
Definition: documents.c:127
xsltDocLoaderFunc xsltDocDefaultLoader
Definition: documents.c:93
GLuint res
Definition: glext.h:9613
int xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt)
Definition: imports.c:276
XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement(const xmlDoc *doc)
Definition: tree.h:551
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:160
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
@ XSLT_DEBUG_NONE
Definition: xsltutils.h:273

Referenced by xsltDocumentFunctionLoadDocument().

◆ xsltLoadStyleDocument()

XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltLoadStyleDocument ( xsltStylesheetPtr  style,
const xmlChar URI 
)

xsltLoadStyleDocument: @style: an XSLT style sheet @URI: the computed URI of the document

Try to load a stylesheet document within the XSLT transformation context

Returns the new xsltDocumentPtr or NULL in case of error

Definition at line 343 of file documents.c.

343 {
345 xmlDocPtr doc;
347
348 if ((style == NULL) || (URI == NULL))
349 return(NULL);
350
351 /*
352 * Security framework check
353 */
355 if (sec != NULL) {
356 int res;
357
358 res = xsltCheckRead(sec, NULL, URI);
359 if (res <= 0) {
360 if (res == 0)
362 "xsltLoadStyleDocument: read rights for %s denied\n",
363 URI);
364 return(NULL);
365 }
366 }
367
368 /*
369 * Walk the context list to find the document if preparsed
370 */
371 ret = style->docList;
372 while (ret != NULL) {
373 if ((ret->doc != NULL) && (ret->doc->URL != NULL) &&
374 (xmlStrEqual(ret->doc->URL, URI)))
375 return(ret);
376 ret = ret->next;
377 }
378
380 (void *) style, XSLT_LOAD_STYLESHEET);
381 if (doc == NULL)
382 return(NULL);
383
385 return(ret);
386}
xsltSecurityPrefsPtr xsltGetDefaultSecurityPrefs(void)
Definition: security.c:163
xsltDocumentPtr xsltNewStyleDocument(xsltStylesheetPtr style, xmlDocPtr doc)
Definition: documents.c:166
#define XSLT_PARSE_OPTIONS
Definition: xslt.h:54

Referenced by xsltParseStylesheetInclude().

◆ xsltNewDocument()

xsltNewDocument: @ctxt: an XSLT transformation context (or NULL) @doc: a parsed XML document

Register a new document, apply key computations

Returns a handler to the document

Definition at line 127 of file documents.c.

127 {
129
131 if (cur == NULL) {
133 "xsltNewDocument : malloc failed\n");
134 return(NULL);
135 }
136 memset(cur, 0, sizeof(xsltDocument));
137 cur->doc = doc;
138 if (ctxt != NULL) {
139 if (! XSLT_IS_RES_TREE_FRAG(doc)) {
140 cur->next = ctxt->docList;
141 ctxt->docList = cur;
142 }
143 /*
144 * A key with a specific name for a specific document
145 * will only be computed if there's a call to the key()
146 * function using that specific name for that specific
147 * document. I.e. computation of keys will be done in
148 * xsltGetKey() (keys.c) on an on-demand basis.
149 *
150 * xsltInitCtxtKeys(ctxt, cur); not called here anymore
151 */
152 }
153 return(cur);
154}
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:248
#define memset(x, y, z)
Definition: compat.h:39
Definition: tree.h:489
#define XSLT_IS_RES_TREE_FRAG(n)
Definition: xsltInternals.h:56
xsltDocument * xsltDocumentPtr

Referenced by xsltComputeAllKeys(), xsltKeyFunction(), xsltLoadDocument(), and xsltNewTransformContext().

◆ xsltNewStyleDocument()

XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltNewStyleDocument ( xsltStylesheetPtr  style,
xmlDocPtr  doc 
)

xsltNewStyleDocument: @style: an XSLT style sheet @doc: a parsed XML document

Register a new document, apply key computations

Returns a handler to the document

Definition at line 166 of file documents.c.

166 {
168
170 if (cur == NULL) {
172 "xsltNewStyleDocument : malloc failed\n");
173 return(NULL);
174 }
175 memset(cur, 0, sizeof(xsltDocument));
176 cur->doc = doc;
177 if (style != NULL) {
178 cur->next = style->docList;
179 style->docList = cur;
180 }
181 return(cur);
182}

Referenced by xsltLoadStyleDocument().

◆ xsltSetLoaderFunc()

XSLTPUBFUN void XSLTCALL xsltSetLoaderFunc ( xsltDocLoaderFunc  f)

xsltSetLoaderFunc: @f: the new function to handle document loading.

Set the new function to load document, if NULL it resets it to the default function.

Definition at line 104 of file documents.c.

104 {
105 if (f == NULL)
107 else
109}
static xmlDocPtr xsltDocDefaultLoaderFunc(const xmlChar *URI, xmlDictPtr dict, int options, void *ctxt ATTRIBUTE_UNUSED, xsltLoadType type ATTRIBUTE_UNUSED)
Definition: documents.c:44
GLfloat f
Definition: glext.h:7540
#define f
Definition: ke_i.h:83

Variable Documentation

◆ xsltDocDefaultLoader

XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader

Definition at line 86 of file documents.h.