php-doc-en/reference/xslt/functions/xslt-set-object.xml
Hannes Magnusson c030e2adf7 Upgrade to DocBook5:
- All id attributes are now xml:id
 - Add docbook namespace to all root elements
 - Replace <ulink /> with <link xlink:href />
 - Minor markup fixes here and there


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@238160 c90b9560-bf6c-de11-be94-00142212c4b1
2007-06-20 22:25:43 +00:00

120 lines
2.9 KiB
XML
Executable file

<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.9 $ -->
<refentry xml:id="function.xslt-set-object" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>xslt_set_object</refname>
<refpurpose>Sets the object in which to resolve callback functions</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>xslt_set_object</methodname>
<methodparam><type>resource</type><parameter>processor</parameter></methodparam>
<methodparam><type>object</type><parameter role="reference">obj</parameter></methodparam>
</methodsynopsis>
<para>
This function allows to use the <parameter>processor</parameter> inside
an <parameter>object</parameter> and to resolve all callback functions
in it.
</para>
<para>
The callback functions can be declared with
<function>xml_set_sax_handlers</function>,
<function>xslt_set_scheme_handlers</function> or
<function>xslt_set_error_handler</function> and are assumed to be methods
of <parameter>object</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>processor</parameter></term>
<listitem>
<para>
The XSLT processor link identifier, created with
<function>xslt_create</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>obj</parameter></term>
<listitem>
<para>
An object.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="description">
&reftitle.examples;
<example>
<title>Using your own error handler as a method</title>
<programlisting role="php">
<![CDATA[
<?php
class my_xslt_processor {
var $_xh; // our XSLT processor
function my_xslt_processor()
{
$this->_xh = xslt_create();
// Make $this object the callback resolver
xslt_set_object($this->_xh, $this);
// Let's handle the errors
xslt_set_error_handler($this->_xh, "my_xslt_error_handler");
}
function my_xslt_error_handler($handler, $errno, $level, $info)
{
// for now, let's just see the arguments
var_dump(func_get_args());
}
}
?>
]]>
</programlisting>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->