summaryrefslogtreecommitdiff
path: root/doc/html/libxslt-templates.html
blob: c69c05794c789a0657be80a7dfd78bf75b6a1b7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><style type="text/css">
TD {font-family: Verdana,Arial,Helvetica}
BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
H1 {font-family: Verdana,Arial,Helvetica}
H2 {font-family: Verdana,Arial,Helvetica}
H3 {font-family: Verdana,Arial,Helvetica}
A:link, A:visited, A:active { text-decoration: underline }
    </style><title>Module templates from libxslt</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="../epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="../gnome2.png" alt="GNOME2 Logo" /></a><a href="http://www.w3.org/Status"><img src="../w3c.png" alt="W3C logo" /></a><a href="http://www.redhat.com"><img src="../redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/XSLT/"><img src="../Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XSLT C library for GNOME</h1><h2>Module templates from libxslt</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a style="font-weight:bold" href="../index.html">Main Menu</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="../ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li><li><a href="http://xmlsoft.org/">XML libxml2</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading17">XSLT with PHP</a></li><li><a href="http://www.mod-xslt2.com/">Apache module</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="../APIchunk0.html">Alphabetic</a></li><li><a href="../APIconstructors.html">Constructors</a></li><li><a href="../APIfunctions.html">Functions/Types</a></li><li><a href="../APIfiles.html">Modules</a></li><li><a href="../APIsymbols.html">Symbols</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxslt-security.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxslt-security.html">security</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="../index.html">Home</a></th><th align="right"><a href="libxslt-transform.html">transform</a></th><td><a accesskey="n" href="libxslt-transform.html"><img src="right.png" width="24" height="24" border="0" alt="Next" /></a></td></tr></table><p>This set of routine encapsulates XPath calls and Attribute Value Templates evaluation. </p><h2>Table of Contents</h2><pre class="programlisting">xmlAttrPtr	<a href="#xsltAttrListTemplateProcess">xsltAttrListTemplateProcess</a>	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />						 xmlNodePtr target, <br />						 xmlAttrPtr attrs)</pre>
<pre class="programlisting">xmlAttrPtr	<a href="#xsltAttrTemplateProcess">xsltAttrTemplateProcess</a>	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlNodePtr target, <br />					 xmlAttrPtr attr)</pre>
<pre class="programlisting">xmlChar *	<a href="#xsltAttrTemplateValueProcess">xsltAttrTemplateValueProcess</a>	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />						 const xmlChar * str)</pre>
<pre class="programlisting">xmlChar *	<a href="#xsltAttrTemplateValueProcessNode">xsltAttrTemplateValueProcessNode</a>	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />							 const xmlChar * str, <br />							 xmlNodePtr inst)</pre>
<pre class="programlisting">xmlChar *	<a href="#xsltEvalAttrValueTemplate">xsltEvalAttrValueTemplate</a>	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />						 xmlNodePtr inst, <br />						 const xmlChar * name, <br />						 const xmlChar * ns)</pre>
<pre class="programlisting">const xmlChar *	<a href="#xsltEvalStaticAttrValueTemplate">xsltEvalStaticAttrValueTemplate</a>	(<a href="libxslt-xsltInternals.html#xsltStylesheetPtr">xsltStylesheetPtr</a> style, <br />						 xmlNodePtr inst, <br />						 const xmlChar * name, <br />						 const xmlChar * ns, <br />						 int * found)</pre>
<pre class="programlisting">xmlChar *	<a href="#xsltEvalTemplateString">xsltEvalTemplateString</a>	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlNodePtr contextNode, <br />					 xmlNodePtr inst)</pre>
<pre class="programlisting">int	<a href="#xsltEvalXPathPredicate">xsltEvalXPathPredicate</a>		(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlXPathCompExprPtr comp, <br />					 xmlNsPtr * nsList, <br />					 int nsNr)</pre>
<pre class="programlisting">xmlChar *	<a href="#xsltEvalXPathString">xsltEvalXPathString</a>	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlXPathCompExprPtr comp)</pre>
<pre class="programlisting">xmlChar *	<a href="#xsltEvalXPathStringNs">xsltEvalXPathStringNs</a>	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlXPathCompExprPtr comp, <br />					 int nsNr, <br />					 xmlNsPtr * nsList)</pre>
<pre class="programlisting">xmlNodePtr *	<a href="#xsltTemplateProcess">xsltTemplateProcess</a>	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlNodePtr node)</pre>
<h2>Description</h2>
<h3><a name="xsltAttrListTemplateProcess" id="xsltAttrListTemplateProcess"></a>Function: xsltAttrListTemplateProcess</h3><pre class="programlisting">xmlAttrPtr	xsltAttrListTemplateProcess	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />						 xmlNodePtr target, <br />						 xmlAttrPtr attrs)<br />
</pre><p>Processes all attributes of a Literal Result Element. Attribute references are applied via xsl:use-attribute-set attributes. Copies all non XSLT-attributes over to the @target element and evaluates Attribute Value Templates. Called by xsltApplySequenceConstructor() (transform.c).</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>target</tt></i>:</span></td><td>the element where the attributes will be grafted</td></tr><tr><td><span class="term"><i><tt>attrs</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a new list of attribute nodes, or NULL in case of error. (Don't assign the result to @target-&gt;properties; if the result is NULL, you'll get memory leaks, since the attributes will be disattached.)</td></tr></tbody></table></div><h3><a name="xsltAttrTemplateProcess" id="xsltAttrTemplateProcess"></a>Function: xsltAttrTemplateProcess</h3><pre class="programlisting">xmlAttrPtr	xsltAttrTemplateProcess	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlNodePtr target, <br />					 xmlAttrPtr attr)<br />
</pre><p>Process one attribute of a Literal Result Element (in the stylesheet). Evaluates Attribute Value Templates and copies the attribute over to the result element. This does *not* process attribute sets (xsl:use-attribute-set).</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>target</tt></i>:</span></td><td>the element where the attribute will be grafted</td></tr><tr><td><span class="term"><i><tt>attr</tt></i>:</span></td><td>the attribute node of a literal result element</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the generated attribute node.</td></tr></tbody></table></div><h3><a name="xsltAttrTemplateValueProcess" id="xsltAttrTemplateValueProcess"></a>Function: xsltAttrTemplateValueProcess</h3><pre class="programlisting">xmlChar *	xsltAttrTemplateValueProcess	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />						 const xmlChar * str)<br />
</pre><p>Process the given node and return the new string value.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the attribute template node value</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the computed string value or NULL, must be deallocated by the caller.</td></tr></tbody></table></div><h3><a name="xsltAttrTemplateValueProcessNode" id="xsltAttrTemplateValueProcessNode"></a>Function: xsltAttrTemplateValueProcessNode</h3><pre class="programlisting">xmlChar *	xsltAttrTemplateValueProcessNode	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />							 const xmlChar * str, <br />							 xmlNodePtr inst)<br />
</pre><p>Process the given string, allowing to pass a namespace mapping context and return the new string value. Called by: - xsltAttrTemplateValueProcess() (templates.c) - xsltEvalAttrValueTemplate() (templates.c) QUESTION: Why is this function public? It is not used outside of templates.c.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the attribute template node value</td></tr><tr><td><span class="term"><i><tt>inst</tt></i>:</span></td><td>the instruction (or LRE) in the stylesheet holding the attribute with an AVT</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the computed string value or NULL, must be deallocated by the caller.</td></tr></tbody></table></div><h3><a name="xsltEvalAttrValueTemplate" id="xsltEvalAttrValueTemplate"></a>Function: xsltEvalAttrValueTemplate</h3><pre class="programlisting">xmlChar *	xsltEvalAttrValueTemplate	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />						 xmlNodePtr inst, <br />						 const xmlChar * name, <br />						 const xmlChar * ns)<br />
</pre><p>Evaluate a attribute value template, i.e. the attribute value can contain expressions contained in curly braces ({}) and those are substituted by they computed value.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>inst</tt></i>:</span></td><td>the instruction (or LRE) in the stylesheet holding the attribute with an AVT</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the attribute QName</td></tr><tr><td><span class="term"><i><tt>ns</tt></i>:</span></td><td>the attribute namespace URI</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the computed string value or NULL, must be deallocated by the caller.</td></tr></tbody></table></div><h3><a name="xsltEvalStaticAttrValueTemplate" id="xsltEvalStaticAttrValueTemplate"></a>Function: xsltEvalStaticAttrValueTemplate</h3><pre class="programlisting">const xmlChar *	xsltEvalStaticAttrValueTemplate	(<a href="libxslt-xsltInternals.html#xsltStylesheetPtr">xsltStylesheetPtr</a> style, <br />						 xmlNodePtr inst, <br />						 const xmlChar * name, <br />						 const xmlChar * ns, <br />						 int * found)<br />
</pre><p>Check if an attribute value template has a static value, i.e. the attribute value does not contain expressions contained in curly braces ({})</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>style</tt></i>:</span></td><td>the XSLT stylesheet</td></tr><tr><td><span class="term"><i><tt>inst</tt></i>:</span></td><td>the instruction (or LRE) in the stylesheet holding the attribute with an AVT</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the attribute Name</td></tr><tr><td><span class="term"><i><tt>ns</tt></i>:</span></td><td>the attribute namespace URI</td></tr><tr><td><span class="term"><i><tt>found</tt></i>:</span></td><td>indicator whether the attribute is present</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the static string value or NULL, must be deallocated by the caller.</td></tr></tbody></table></div><h3><a name="xsltEvalTemplateString" id="xsltEvalTemplateString"></a>Function: xsltEvalTemplateString</h3><pre class="programlisting">xmlChar *	xsltEvalTemplateString	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlNodePtr contextNode, <br />					 xmlNodePtr inst)<br />
</pre><p>Processes the sequence constructor of the given instruction on @contextNode and converts the resulting tree to a string. This is needed by e.g. xsl:comment and xsl:processing-instruction.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>contextNode</tt></i>:</span></td><td>the current node in the source tree</td></tr><tr><td><span class="term"><i><tt>inst</tt></i>:</span></td><td>the XSLT instruction (xsl:comment, xsl:processing-instruction)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the computed string value or NULL; it's up to the caller to free the result.</td></tr></tbody></table></div><h3><a name="xsltEvalXPathPredicate" id="xsltEvalXPathPredicate"></a>Function: xsltEvalXPathPredicate</h3><pre class="programlisting">int	xsltEvalXPathPredicate		(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlXPathCompExprPtr comp, <br />					 xmlNsPtr * nsList, <br />					 int nsNr)<br />
</pre><p>Process the expression using XPath and evaluate the result as an XPath predicate</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the XPath compiled expression</td></tr><tr><td><span class="term"><i><tt>nsList</tt></i>:</span></td><td>the namespaces in scope</td></tr><tr><td><span class="term"><i><tt>nsNr</tt></i>:</span></td><td>the number of namespaces in scope</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 is the predicate was true, 0 otherwise</td></tr></tbody></table></div><h3><a name="xsltEvalXPathString" id="xsltEvalXPathString"></a>Function: xsltEvalXPathString</h3><pre class="programlisting">xmlChar *	xsltEvalXPathString	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlXPathCompExprPtr comp)<br />
</pre><p>Process the expression using XPath and get a string</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the compiled XPath expression</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the computed string value or NULL, must be deallocated by the caller.</td></tr></tbody></table></div><h3><a name="xsltEvalXPathStringNs" id="xsltEvalXPathStringNs"></a>Function: xsltEvalXPathStringNs</h3><pre class="programlisting">xmlChar *	xsltEvalXPathStringNs	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlXPathCompExprPtr comp, <br />					 int nsNr, <br />					 xmlNsPtr * nsList)<br />
</pre><p>Process the expression using XPath, allowing to pass a namespace mapping context and get a string</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the compiled XPath expression</td></tr><tr><td><span class="term"><i><tt>nsNr</tt></i>:</span></td><td>the number of namespaces in the list</td></tr><tr><td><span class="term"><i><tt>nsList</tt></i>:</span></td><td>the list of in-scope namespaces to use</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the computed string value or NULL, must be deallocated by the caller.</td></tr></tbody></table></div><h3><a name="xsltTemplateProcess" id="xsltTemplateProcess"></a>Function: xsltTemplateProcess</h3><pre class="programlisting">xmlNodePtr *	xsltTemplateProcess	(<a href="libxslt-xsltInternals.html#xsltTransformContextPtr">xsltTransformContextPtr</a> ctxt, <br />					 xmlNodePtr node)<br />
</pre><p>Obsolete. Does always return NULL. Don't use it.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XSLT transformation context</td></tr><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>the attribute template node</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td></td></tr></tbody></table></div><p><a href="../bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>