<?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision$ --> <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>xslt_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:"~/.phpdoc/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 -->