kennyt          Sun Mar 28 01:42:32 2004 EDT

  Added files:                 
    /phpdoc/en/reference/xsl    .cvsignore reference.xml 

  Modified files:              
    /phpdoc     manual.xml.in 
  Log:
  Adding a bit of documentation for /ext/xsl.
  
  
http://cvs.php.net/diff.php/phpdoc/manual.xml.in?r1=1.164&r2=1.165&ty=u
Index: phpdoc/manual.xml.in
diff -u phpdoc/manual.xml.in:1.164 phpdoc/manual.xml.in:1.165
--- phpdoc/manual.xml.in:1.164  Tue Feb 24 09:31:47 2004
+++ phpdoc/manual.xml.in        Sun Mar 28 01:42:32 2004
@@ -212,6 +212,7 @@
   &reference.xml.reference;
   &reference.xmlrpc.reference;
   &reference.xdiff.reference;
+  &reference.xsl.reference;
   &reference.xslt.reference;
   &reference.yaz.reference;
   &reference.nis.reference;

http://cvs.php.net/co.php/phpdoc/en/reference/xsl/.cvsignore?r=1.1&p=1
Index: phpdoc/en/reference/xsl/.cvsignore
+++ phpdoc/en/reference/xsl/.cvsignore
functions.xml

http://cvs.php.net/co.php/phpdoc/en/reference/xsl/reference.xml?r=1.1&p=1
Index: phpdoc/en/reference/xsl/reference.xml
+++ phpdoc/en/reference/xsl/reference.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
 <reference id="ref.xsl">
  <title>XSL functions</title>
  <titleabbrev>XSL</titleabbrev>

  <partintro>
   <section id="xsl.intro">
    &reftitle.intro;
    &warn.experimental;
    <para>
     The XSL extension implements the XSL standard, performing
     XSLT transformations using the libxslt library.
    </para>
   </section>

   <section id="xsl.installation">
    &reftitle.install;
    <para>
     PHP 5 includes XSL by default, but it can be enabled
     explicitly by adding the argument
     <option role="configure">--enable-xsl[=DIR]</option>.
     <literal>DIR</literal> is the libxslt installation directory.
    </para>
   </section>
   
   <section id="xsl.examples">
    &reftitle.examples;
    <para>
     In this small tutorial we will learn how to transform an XML
     document into HTML.
    </para>
    <section id="xsl.examples.sources">
     <example>
      <title>A simple XSL tree</title>
      <programlisting role="xml">
<![CDATA[
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:output method="html" encoding="iso-8859-1" indent="no"/>
 <xsl:template match="collection">
  Hey! Welcome to my sweet CD collection!
  <xsl:apply-templates/>
 </xsl:template>
 <xsl:template match="cd">
  <h1><xsl:value-of select="title"/></h1>
  <h2>by <xsl:value-of select="artist"/></h2>
  <h3> - <xsl:value-of select="year"/></h3>
 </xsl:template>
</xsl:stylesheet>
]]>
      </programlisting>
     </example>
     <example>
      <title>Corresponding XML tree</title>
      <programlisting role="xml">
<![CDATA[
<collection>
 <cd>
  <title>PHP Rock</title>
  <artist>Joe Coder</artist>
  <year>2003</year>
 </cd>
 <cd>
  <title>Squashing Typos on a Winter's Eve</title>
  <artist>kennyt</artist>
  <year>2004</year>
 </cd>
</collection>
]]>
      </programlisting>
     </example>
    </section>
    <example>
     <title>Making XML into HTML</title>
     <simpara>
      The following PHP code uses the XML and XSL extensions to
      transform XML into presentable HTML.
     </simpara>
     <programlisting role="php">
<![CDATA[
<?php
/* Load the two XML sources */
$xml = new DomDocument; // from /ext/dom
$xml->load('example.xml');

$xsl = new DomDocument;
$xsl->load('example.xsl');

/* Configure the transformer */
$proc = new xsltprocessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo $proc->transformToXML($xml); // actual transformation
?>
]]>
     </programlisting>
     <simpara>
      This should produce an HTML fragment similar to the following:
     </simpara>
     <screen>
<![CDATA[
Hey! Welcome to my sweet CD collection!

<h1>PHP Rock</h1>
<h2>by Joe Coder</h2>
<h3> - 2003</h3>

<h1>Squashing Typos on a Winter's Eve</h1>
<h2> by kennyt</h2>
<h3> - 2004</h3>
]]>
     </screen>
    </example>
   </section>
  </partintro>

&reference.xsl.functions;

 </reference>
<!-- 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
-->

Reply via email to