## documents

documents - interface for the document handling

implements document loading and cache (multiple document() reference for the same resources must be equal.

Author(s): Daniel Veillard

## Synopsis

    typedef enum xsltLoadType;
    void	xsltFreeStyleDocuments		(xsltStylesheetPtr style);
    typedef xmlDocPtr xsltDocLoaderFunc	(const xmlChar * URI,
    					 xmlDictPtr dict,
    					 int options,
    					 void * ctxt,
    					 xsltLoadType type);
    xsltDocumentPtr	xsltLoadDocument	(xsltTransformContextPtr ctxt,
    					 const xmlChar * URI);
    xsltDocumentPtr	xsltNewStyleDocument	(xsltStylesheetPtr style,
    					 xmlDocPtr doc);
    void	xsltSetLoaderFunc		(xsltDocLoaderFunc f);
    void	xsltFreeDocuments		(xsltTransformContextPtr ctxt);
    xsltDocumentPtr	xsltNewDocument		(xsltTransformContextPtr ctxt,
    					 xmlDocPtr doc);
    xsltDocumentPtr	xsltLoadStyleDocument	(xsltStylesheetPtr style,
    					 const xmlChar * URI);
    xsltDocumentPtr	xsltFindDocument	(xsltTransformContextPtr ctxt,
    					 xmlDocPtr doc);

## Description

## Details

### Enum xsltLoadType

    enum xsltLoadType {
        XSLT_LOAD_START = 0 /* loading for a top stylesheet */
        XSLT_LOAD_STYLESHEET = 1 /* loading for a stylesheet include/import */
        XSLT_LOAD_DOCUMENT = 2 /*  loading document at transformation time */
    };

### Function type xsltDocLoaderFunc

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

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.

`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
`Returns`: | the pointer to the document (which will be modified and freed by the engine later), or NULL in case of error.

### Variable xsltDocDefaultLoader

    xsltDocLoaderFunc xsltDocDefaultLoader;

### xsltFindDocument ()

    xsltDocumentPtr	xsltFindDocument	(xsltTransformContextPtr ctxt,
    					 xmlDocPtr doc)

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

`ctxt`: | an XSLT transformation context
`doc`: | a parsed XML document
`Returns`: | the desired xsltDocumentPtr or NULL in case of error

### xsltFreeDocuments ()

    void	xsltFreeDocuments		(xsltTransformContextPtr ctxt)

Free up all the space used by the loaded documents

`ctxt`: | an XSLT transformation context

### xsltFreeStyleDocuments ()

    void	xsltFreeStyleDocuments		(xsltStylesheetPtr style)

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

`style`: | an XSLT stylesheet (representing a stylesheet-level)

### xsltLoadDocument ()

    xsltDocumentPtr	xsltLoadDocument	(xsltTransformContextPtr ctxt,
    					 const xmlChar * URI)

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

`ctxt`: | an XSLT transformation context
`URI`: | the computed URI of the document
`Returns`: | the new xsltDocumentPtr or NULL in case of error

### xsltLoadStyleDocument ()

    xsltDocumentPtr	xsltLoadStyleDocument	(xsltStylesheetPtr style,
    					 const xmlChar * URI)

Try to load a stylesheet document within the XSLT transformation context

`style`: | an XSLT style sheet
`URI`: | the computed URI of the document
`Returns`: | the new xsltDocumentPtr or NULL in case of error

### xsltNewDocument ()

    xsltDocumentPtr	xsltNewDocument		(xsltTransformContextPtr ctxt,
    					 xmlDocPtr doc)

Register a new document, apply key computations

`ctxt`: | an XSLT transformation context (or NULL)
`doc`: | a parsed XML document
`Returns`: | a handler to the document

### xsltNewStyleDocument ()

    xsltDocumentPtr	xsltNewStyleDocument	(xsltStylesheetPtr style,
    					 xmlDocPtr doc)

Register a new document, apply key computations

`style`: | an XSLT style sheet
`doc`: | a parsed XML document
`Returns`: | a handler to the document

### xsltSetLoaderFunc ()

    void	xsltSetLoaderFunc		(xsltDocLoaderFunc f)

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

`f`: | the new function to handle document loading.