<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="xsltprocessor.transformtodoc" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>XSLTProcessor::transformToDoc</refname>
  <refpurpose>Transform to a document</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="XSLTProcessor">
   <modifier>public</modifier> <type class="union"><type>object</type><type>false</type></type><methodname>XSLTProcessor::transformToDoc</methodname>
   <methodparam><type>object</type><parameter>document</parameter></methodparam>
   <methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>returnClass</parameter><initializer>&null;</initializer></methodparam>
  </methodsynopsis>
  <para>
   Transforms the source node to a document (e.g. <classname>DOMDocument</classname>) applying
   the stylesheet given by the
   <function>XSLTProcessor::importStylesheet</function> method.
  </para>
 </refsect1>
 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>document</parameter></term>
     <listitem>
      <para>
       The <classname>DOMDocument</classname> or <classname>SimpleXMLElement</classname> or libxml-compatible
       object to be transformed.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>returnClass</parameter></term>
     <listitem>
      <para>
       This optional parameter may be used so that
       <methodname>XSLTProcessor::transformToDoc</methodname>
       will return an object of the specified class.
       That class should either extend or be the same class as <parameter>document</parameter>'s class.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The resulting document or &false; on error.
  </para>
 </refsect1>
 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Transforming to a DOMDocument</title>
    <programlisting role="php">
<![CDATA[
<?php

// Load the XML source
$xml = new DOMDocument;
$xml->load('collection.xml');

$xsl = new DOMDocument;
$xsl->load('collection.xsl');

// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules

echo trim($proc->transformToDoc($xml)->firstChild->wholeText);

?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
Hey! Welcome to Nicolas Eliaszewicz's sweet CD collection!
]]>
    </screen>
   </example>
  </para>
 </refsect1>
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>XSLTProcessor::transformToUri</function></member>
    <member><function>XSLTProcessor::transformToXml</function></member>
   </simplelist>
  </para>
 </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
-->
