ReactOS 0.4.16-dev-2279-gc890759
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()

XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltFindDocument ( xsltTransformContextPtr  ctxt,
xmlDocPtr  doc 
)

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 417 of file documents.c.

417 {
419
420 if ((ctxt == NULL) || (doc == NULL))
421 return(NULL);
422
423 /*
424 * Walk the context list to find the document
425 */
426 ret = ctxt->docList;
427 while (ret != NULL) {
428 if (ret->doc == doc)
429 return(ret);
430 ret = ret->next;
431 }
432 if (doc == ctxt->style->doc)
433 return(ctxt->document);
434 return(NULL);
435}
#define NULL
Definition: types.h:112
return ret
Definition: mutex.c:146
xsltDocumentPtr document
xsltStylesheetPtr style
xsltDocumentPtr docList

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 249 of file documents.c.

249 {
250 xsltDocumentPtr doc, cur;
251
252 cur = ctxt->docList;
253 while (cur != NULL) {
254 doc = cur;
255 cur = cur->next;
257 if (!doc->main)
258 xmlFreeDoc(doc->doc);
259 xmlFree(doc);
260 }
261 cur = ctxt->styleList;
262 while (cur != NULL) {
263 doc = cur;
264 cur = cur->next;
266 if (!doc->main)
267 xmlFreeDoc(doc->doc);
268 xmlFree(doc);
269 }
270}
FxCollectionEntry * cur
void xsltFreeDocumentKeys(xsltDocumentPtr idoc)
Definition: keys.c:931
xmlFreeFunc xmlFree
Definition: globals.c:184
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 208 of file documents.c.

208 {
209 xsltDocumentPtr doc, cur;
210#ifdef XSLT_REFACTORED_XSLT_NSCOMP
211 xsltNsMapPtr nsMap;
212#endif
213
214 if (style == NULL)
215 return;
216
217#ifdef XSLT_REFACTORED_XSLT_NSCOMP
218 if (XSLT_HAS_INTERNAL_NSMAP(style))
219 nsMap = XSLT_GET_INTERNAL_NSMAP(style);
220 else
221 nsMap = NULL;
222#endif
223
224 cur = style->docList;
225 while (cur != NULL) {
226 doc = cur;
227 cur = cur->next;
228#ifdef XSLT_REFACTORED_XSLT_NSCOMP
229 /*
230 * Restore all changed namespace URIs of ns-decls.
231 */
232 if (nsMap)
233 xsltRestoreDocumentNamespaces(nsMap, doc->doc);
234#endif
236 if (!doc->main)
237 xmlFreeDoc(doc->doc);
238 xmlFree(doc);
239 }
240}
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 283 of file documents.c.

283 {
285 xmlDocPtr doc;
286
287 if ((ctxt == NULL) || (URI == NULL))
288 return(NULL);
289
290 /*
291 * Security framework check
292 */
293 if (ctxt->sec != NULL) {
294 int res;
295
296 res = xsltCheckRead(ctxt->sec, ctxt, URI);
297 if (res <= 0) {
298 if (res == 0)
300 "xsltLoadDocument: read rights for %s denied\n",
301 URI);
302 return(NULL);
303 }
304 }
305
306 /*
307 * Walk the context list to find the document if preparsed
308 */
309 ret = ctxt->docList;
310 while (ret != NULL) {
311 if ((ret->doc != NULL) && (ret->doc->URL != NULL) &&
312 (xmlStrEqual(ret->doc->URL, URI)))
313 return(ret);
314 ret = ret->next;
315 }
316
317 doc = xsltDocDefaultLoader(URI, ctxt->dict, ctxt->parserOptions,
318 (void *) ctxt, XSLT_LOAD_DOCUMENT);
319
320 if (doc == NULL)
321 return(NULL);
322
323 if (ctxt->xinclude != 0) {
324#ifdef LIBXML_XINCLUDE_ENABLED
325#if LIBXML_VERSION >= 20603
326 xmlXIncludeProcessFlags(doc, ctxt->parserOptions);
327#else
328 xmlXIncludeProcess(doc);
329#endif
330#else
332 "xsltLoadDocument(%s) : XInclude processing not compiled in\n",
333 URI);
334#endif
335 }
336 /*
337 * Apply white-space stripping if asked for
338 */
340 xsltApplyStripSpaces(ctxt, xmlDocGetRootElement(doc));
341 if (ctxt->debugStatus == XSLT_DEBUG_NONE)
342 xmlXPathOrderDocElems(doc);
343
344 ret = xsltNewDocument(ctxt, doc);
345 return(ret);
346}
int xsltCheckRead(xsltSecurityPrefsPtr sec, xsltTransformContextPtr ctxt, const xmlChar *URL)
Definition: security.c:419
void xsltApplyStripSpaces(xsltTransformContextPtr ctxt, xmlNodePtr node)
Definition: transform.c:5649
xsltDocumentPtr xsltNewDocument(xsltTransformContextPtr ctxt, xmlDocPtr doc)
Definition: documents.c:142
xsltDocLoaderFunc xsltDocDefaultLoader
Definition: documents.c:108
GLuint res
Definition: glext.h:9613
int xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt)
Definition: imports.c:322
XMLPUBFUN int xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:162
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:762
@ XSLT_DEBUG_NONE
Definition: xsltutils.h:304

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 358 of file documents.c.

358 {
360 xmlDocPtr doc;
362
363 if ((style == NULL) || (URI == NULL))
364 return(NULL);
365
366 /*
367 * Security framework check
368 */
370 if (sec != NULL) {
371 int res;
372
373 res = xsltCheckRead(sec, NULL, URI);
374 if (res <= 0) {
375 if (res == 0)
377 "xsltLoadStyleDocument: read rights for %s denied\n",
378 URI);
379 return(NULL);
380 }
381 }
382
383 /*
384 * Walk the context list to find the document if preparsed
385 */
386 ret = style->docList;
387 while (ret != NULL) {
388 if ((ret->doc != NULL) && (ret->doc->URL != NULL) &&
389 (xmlStrEqual(ret->doc->URL, URI)))
390 return(ret);
391 ret = ret->next;
392 }
393
395 (void *) style, XSLT_LOAD_STYLESHEET);
396 if (doc == NULL)
397 return(NULL);
398
400 if (ret == NULL)
401 xmlFreeDoc(doc);
402 return(ret);
403}
xsltSecurityPrefsPtr xsltGetDefaultSecurityPrefs(void)
Definition: security.c:180
xsltDocumentPtr xsltNewStyleDocument(xsltStylesheetPtr style, xmlDocPtr doc)
Definition: documents.c:181
#define XSLT_PARSE_OPTIONS
Definition: xslt.h:54

Referenced by xsltParseStylesheetInclude().

◆ xsltNewDocument()

XSLTPUBFUN xsltDocumentPtr XSLTCALL xsltNewDocument ( xsltTransformContextPtr  ctxt,
xmlDocPtr  doc 
)

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 142 of file documents.c.

142 {
144
146 if (cur == NULL) {
147 xsltTransformError(ctxt, NULL, (xmlNodePtr) doc,
148 "xsltNewDocument : malloc failed\n");
149 return(NULL);
150 }
151 memset(cur, 0, sizeof(xsltDocument));
152 cur->doc = doc;
153 if (ctxt != NULL) {
154 if (! XSLT_IS_RES_TREE_FRAG(doc)) {
155 cur->next = ctxt->docList;
156 ctxt->docList = cur;
157 }
158 /*
159 * A key with a specific name for a specific document
160 * will only be computed if there's a call to the key()
161 * function using that specific name for that specific
162 * document. I.e. computation of keys will be done in
163 * xsltGetKey() (keys.c) on an on-demand basis.
164 *
165 * xsltInitCtxtKeys(ctxt, cur); not called here anymore
166 */
167 }
168 return(cur);
169}
xmlMallocFunc xmlMalloc
Definition: globals.c:193
#define memset(x, y, z)
Definition: compat.h:39
#define XSLT_IS_RES_TREE_FRAG(n)
Definition: xsltInternals.h:55
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 181 of file documents.c.

181 {
183
185 if (cur == NULL) {
186 xsltTransformError(NULL, style, (xmlNodePtr) doc,
187 "xsltNewStyleDocument : malloc failed\n");
188 return(NULL);
189 }
190 memset(cur, 0, sizeof(xsltDocument));
191 cur->doc = doc;
192 if (style != NULL) {
193 cur->next = style->docList;
194 style->docList = cur;
195 }
196 return(cur);
197}

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 119 of file documents.c.

119 {
120 if (f == NULL)
122 else
124}
static xmlDocPtr xsltDocDefaultLoaderFunc(const xmlChar *URI, xmlDictPtr dict, int options, void *ctxt ATTRIBUTE_UNUSED, xsltLoadType type ATTRIBUTE_UNUSED)
Definition: documents.c:61
GLfloat f
Definition: glext.h:7540
#define f
Definition: ke_i.h:83

Referenced by init_libxslt().

Variable Documentation

◆ xsltDocDefaultLoader

XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader

Definition at line 86 of file documents.h.