| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
| 5 |
<title>documents: interface for the document handling</title> |
| 6 |
<meta name="generator" content="Libxml2 devhelp stylesheet"/> |
| 7 |
<link rel="start" href="index.html" title="libxslt Reference Manual"/> |
| 8 |
<link rel="up" href="general.html" title="API"/> |
| 9 |
<link rel="stylesheet" href="style.css" type="text/css"/> |
| 10 |
<link rel="chapter" href="general.html" title="API"/> |
| 11 |
</head> |
| 12 |
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| 13 |
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> |
| 14 |
<tr valign="middle"> |
| 15 |
<td> |
| 16 |
<a accesskey="p" href="libxslt-attributes.html"> |
| 17 |
<img src="left.png" width="24" height="24" border="0" alt="Prev"/> |
| 18 |
</a> |
| 19 |
</td> |
| 20 |
<td> |
| 21 |
<a accesskey="u" href="general.html"> |
| 22 |
<img src="up.png" width="24" height="24" border="0" alt="Up"/> |
| 23 |
</a> |
| 24 |
</td> |
| 25 |
<td> |
| 26 |
<a accesskey="h" href="index.html"> |
| 27 |
<img src="home.png" width="24" height="24" border="0" alt="Home"/> |
| 28 |
</a> |
| 29 |
</td> |
| 30 |
<td> |
| 31 |
<a accesskey="n" href="libxslt-extensions.html"> |
| 32 |
<img src="right.png" width="24" height="24" border="0" alt="Next"/> |
| 33 |
</a> |
| 34 |
</td> |
| 35 |
<th width="100%" align="center">libxslt Reference Manual</th> |
| 36 |
</tr> |
| 37 |
</table> |
| 38 |
<h2> |
| 39 |
<span class="refentrytitle">documents</span> |
| 40 |
</h2> |
| 41 |
<p>documents - interface for the document handling</p> |
| 42 |
<p>implements document loading and cache (multiple document() reference for the same resources must be equal. </p> |
| 43 |
<p>Author(s): Daniel Veillard </p> |
| 44 |
<div class="refsynopsisdiv"> |
| 45 |
<h2>Synopsis</h2> |
| 46 |
<pre class="synopsis">typedef enum <a href="#xsltLoadType">xsltLoadType</a>; |
| 47 |
typedef xmlDocPtr <a href="#xsltDocLoaderFunc">xsltDocLoaderFunc</a> (const xmlChar * URI, <br/> xmlDictPtr dict, <br/> int options, <br/> void * ctxt, <br/> <a href="libxslt-documents.html#xsltLoadType">xsltLoadType</a> type); |
| 48 |
<a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> <a href="#xsltFindDocument">xsltFindDocument</a> (<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br/> xmlDocPtr doc); |
| 49 |
void <a href="#xsltFreeDocuments">xsltFreeDocuments</a> (<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt); |
| 50 |
void <a href="#xsltFreeStyleDocuments">xsltFreeStyleDocuments</a> (<a href="libxslt-xsltInternals.html#xsltStylesheetPtr">xsltStylesheetPtr</a> style); |
| 51 |
<a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> <a href="#xsltLoadDocument">xsltLoadDocument</a> (<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br/> const xmlChar * URI); |
| 52 |
<a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> <a href="#xsltLoadStyleDocument">xsltLoadStyleDocument</a> (<a href="libxslt-xsltInternals.html#xsltStylesheetPtr">xsltStylesheetPtr</a> style, <br/> const xmlChar * URI); |
| 53 |
<a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> <a href="#xsltNewDocument">xsltNewDocument</a> (<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br/> xmlDocPtr doc); |
| 54 |
<a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> <a href="#xsltNewStyleDocument">xsltNewStyleDocument</a> (<a href="libxslt-xsltInternals.html#xsltStylesheetPtr">xsltStylesheetPtr</a> style, <br/> xmlDocPtr doc); |
| 55 |
void <a href="#xsltSetLoaderFunc">xsltSetLoaderFunc</a> (<a href="libxslt-documents.html#xsltDocLoaderFunc">xsltDocLoaderFunc</a> f); |
| 56 |
</pre> |
| 57 |
</div> |
| 58 |
<div class="refsect1" lang="en"> |
| 59 |
<h2>Description</h2> |
| 60 |
</div> |
| 61 |
<div class="refsect1" lang="en"> |
| 62 |
<h2>Details</h2> |
| 63 |
<div class="refsect2" lang="en"> |
| 64 |
<div class="refsect2" lang="en"><h3><a name="xsltLoadType">Enum </a>xsltLoadType</h3><pre class="programlisting">enum <a href="#xsltLoadType">xsltLoadType</a> { |
| 65 |
<a name="XSLT_LOAD_START">XSLT_LOAD_START</a> = 0 /* loading for a top stylesheet */ |
| 66 |
<a name="XSLT_LOAD_STYLESHEET">XSLT_LOAD_STYLESHEET</a> = 1 /* loading for a stylesheet include/import */ |
| 67 |
<a name="XSLT_LOAD_DOCUMENT">XSLT_LOAD_DOCUMENT</a> = 2 /* loading document at transformation time */ |
| 68 |
}; |
| 69 |
</pre><p/> |
| 70 |
</div> |
| 71 |
<hr/> |
| 72 |
<div class="refsect2" lang="en"><h3><a name="xsltDocLoaderFunc"/>Function type xsltDocLoaderFunc</h3><pre class="programlisting">xmlDocPtr xsltDocLoaderFunc (const xmlChar * URI, <br/> xmlDictPtr dict, <br/> int options, <br/> void * ctxt, <br/> <a href="libxslt-documents.html#xsltLoadType">xsltLoadType</a> type)<br/> |
| 73 |
</pre><p>An <a href="libxslt-documents.html#xsltDocLoaderFunc">xsltDocLoaderFunc</a> 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.</p> |
| 74 |
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>URI</tt></i>:</span></td><td>the URI of the document to load</td></tr><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionary to use when parsing that document</td></tr><tr><td><span class="term"><i><tt>options</tt></i>:</span></td><td>parsing options, a set of xmlParserOption</td></tr><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the context, either a stylesheet or a transformation context</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>the <a href="libxslt-documents.html#xsltLoadType">xsltLoadType</a> indicating the kind of loading required</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the pointer to the document (which will be modified and freed by the engine later), or NULL in case of error.</td></tr></tbody></table></div></div> |
| 75 |
<hr/> |
| 76 |
<div class="refsect2" lang="en"><h3><a name="xsltDocDefaultLoader">Variable </a>xsltDocDefaultLoader</h3><pre class="programlisting"><a href="libxslt-documents.html#xsltDocLoaderFunc">xsltDocLoaderFunc</a> xsltDocDefaultLoader; |
| 77 |
</pre><p/> |
| 78 |
</div> |
| 79 |
<hr/> |
| 80 |
<div class="refsect2" lang="en"><h3><a name="xsltFindDocument"/>xsltFindDocument ()</h3><pre class="programlisting"><a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> xsltFindDocument (<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br/> xmlDocPtr doc)<br/> |
| 81 |
</pre><p>Try to find a document within the XSLT transformation context. This will not find document infos for temporary Result Tree Fragments.</p> |
| 82 |
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>a parsed XML document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the desired <a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> or NULL in case of error</td></tr></tbody></table></div></div> |
| 83 |
<hr/> |
| 84 |
<div class="refsect2" lang="en"><h3><a name="xsltFreeDocuments"/>xsltFreeDocuments ()</h3><pre class="programlisting">void xsltFreeDocuments (<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt)<br/> |
| 85 |
</pre><p>Free up all the space used by the loaded documents</p> |
| 86 |
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an XSLT transformation context</td></tr></tbody></table></div></div> |
| 87 |
<hr/> |
| 88 |
<div class="refsect2" lang="en"><h3><a name="xsltFreeStyleDocuments"/>xsltFreeStyleDocuments ()</h3><pre class="programlisting">void xsltFreeStyleDocuments (<a href="libxslt-xsltInternals.html#xsltStylesheetPtr">xsltStylesheetPtr</a> style)<br/> |
| 89 |
</pre><p>Frees the node-trees (and <a href="libxslt-xsltInternals.html#xsltDocument">xsltDocument</a> structures) of all stylesheet-modules of the stylesheet-level represented by the given @style.</p> |
| 90 |
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>style</tt></i>:</span></td><td>an XSLT stylesheet (representing a stylesheet-level)</td></tr></tbody></table></div></div> |
| 91 |
<hr/> |
| 92 |
<div class="refsect2" lang="en"><h3><a name="xsltLoadDocument"/>xsltLoadDocument ()</h3><pre class="programlisting"><a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> xsltLoadDocument (<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br/> const xmlChar * URI)<br/> |
| 93 |
</pre><p>Try to load a document (not a stylesheet) within the XSLT transformation context</p> |
| 94 |
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>URI</tt></i>:</span></td><td>the computed URI of the document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new <a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> or NULL in case of error</td></tr></tbody></table></div></div> |
| 95 |
<hr/> |
| 96 |
<div class="refsect2" lang="en"><h3><a name="xsltLoadStyleDocument"/>xsltLoadStyleDocument ()</h3><pre class="programlisting"><a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> xsltLoadStyleDocument (<a href="libxslt-xsltInternals.html#xsltStylesheetPtr">xsltStylesheetPtr</a> style, <br/> const xmlChar * URI)<br/> |
| 97 |
</pre><p>Try to load a stylesheet document within the XSLT transformation context</p> |
| 98 |
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>style</tt></i>:</span></td><td>an XSLT style sheet</td></tr><tr><td><span class="term"><i><tt>URI</tt></i>:</span></td><td>the computed URI of the document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new <a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> or NULL in case of error</td></tr></tbody></table></div></div> |
| 99 |
<hr/> |
| 100 |
<div class="refsect2" lang="en"><h3><a name="xsltNewDocument"/>xsltNewDocument ()</h3><pre class="programlisting"><a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> xsltNewDocument (<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br/> xmlDocPtr doc)<br/> |
| 101 |
</pre><p>Register a new document, apply key computations</p> |
| 102 |
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an XSLT transformation context (or NULL)</td></tr><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>a parsed XML document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a handler to the document</td></tr></tbody></table></div></div> |
| 103 |
<hr/> |
| 104 |
<div class="refsect2" lang="en"><h3><a name="xsltNewStyleDocument"/>xsltNewStyleDocument ()</h3><pre class="programlisting"><a href="libxslt-xsltInternals.html#xsltDocumentPtr">xsltDocumentPtr</a> xsltNewStyleDocument (<a href="libxslt-xsltInternals.html#xsltStylesheetPtr">xsltStylesheetPtr</a> style, <br/> xmlDocPtr doc)<br/> |
| 105 |
</pre><p>Register a new document, apply key computations</p> |
| 106 |
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>style</tt></i>:</span></td><td>an XSLT style sheet</td></tr><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>a parsed XML document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a handler to the document</td></tr></tbody></table></div></div> |
| 107 |
<hr/> |
| 108 |
<div class="refsect2" lang="en"><h3><a name="xsltSetLoaderFunc"/>xsltSetLoaderFunc ()</h3><pre class="programlisting">void xsltSetLoaderFunc (<a href="libxslt-documents.html#xsltDocLoaderFunc">xsltDocLoaderFunc</a> f)<br/> |
| 109 |
</pre><p>Set the new function to load document, if NULL it resets it to the default function.</p> |
| 110 |
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>f</tt></i>:</span></td><td>the new function to handle document loading.</td></tr></tbody></table></div></div> |
| 111 |
<hr/> |
| 112 |
</div> |
| 113 |
</div> |
| 114 |
</body> |
| 115 |
</html> |