cvs: phpdoc-it /reference/xslt/functions xslt-create.xml xslt-errno.xml xslt-error.xml xslt-free.xml xslt-process.xml xslt-set-base.xml
xslt-set-encoding.xml

From: Date: Wed, 08 Jun 2005 12:31:54 +0000
Subject: cvs: phpdoc-it /reference/xslt/functions xslt-create.xml xslt-errno.xml xslt-error.xml xslt-free.xml xslt-process.xml xslt-set-base.xml
xslt-set-encoding.xml
Groups: php.doc.it 
Request: Send a blank email to doc-it+get-734@lists.php.net to get a copy of this message
darvina Wed Jun 8 08:31:54 2005 EDT Modified files: /phpdoc-it/reference/xslt/functions xslt-create.xml xslt-errno.xml xslt-error.xml xslt-free.xml xslt-process.xml xslt-set-base.xml xslt-set-encoding.xml Log: Sync to En tree

http://cvs.php.net/diff.php/phpdoc-it/reference/xslt/functions/xslt-create.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-it/reference/xslt/functions/xslt-create.xml diff -u phpdoc-it/reference/xslt/functions/xslt-create.xml:1.4 phpdoc-it/reference/xslt/functions/xslt-create.xml:1.5 --- phpdoc-it/reference/xslt/functions/xslt-create.xml:1.4 Wed May 1 15:16:18 2002 +++ phpdoc-it/reference/xslt/functions/xslt-create.xml Wed Jun 8 08:31:54 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.3 Maintainer: curcio_it Status: ready --> +<!-- EN-Revision: 1.9 Maintainer: curcio_it Status: ready --> <refentry id="function.xslt-create"> <refnamediv> <refname>xslt_create</refname> @@ -16,6 +16,42 @@ altre funzioni XSLT. </para> </refsect1> + <refsect1> + &reftitle.examples; + <example> + <title>Esempio di utilizzo di <function>xslt_create</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +function xml2html($xmldata, $xsl) +{ + /* $xmldata -> your XML */ + /* $xsl -> XSLT file */ + + $path = 'include'; + $arguments = array('/_xml' => $xmldata); + $xsltproc = xslt_create(); + xslt_set_encoding($xsltproc, 'ISO-8859-1'); + $html = + xslt_process($xsltproc, 'arg:/_xml', "$path/$xsl", NULL, $arguments); + + if (empty($html)) { + die('XSLT processing error: '. xslt_error($xsltproc)); + } + xslt_free($xsltproc); + return $html; +} +?> +]]> + </programlisting> + </example> + </refsect1> + <refsect1> + &reftitle.seealso; + <para> + <function>xslt_free</function>. + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/diff.php/phpdoc-it/reference/xslt/functions/xslt-errno.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-it/reference/xslt/functions/xslt-errno.xml diff -u phpdoc-it/reference/xslt/functions/xslt-errno.xml:1.3 phpdoc-it/reference/xslt/functions/xslt-errno.xml:1.4 --- phpdoc-it/reference/xslt/functions/xslt-errno.xml:1.3 Wed May 1 15:06:23 2002 +++ phpdoc-it/reference/xslt/functions/xslt-errno.xml Wed Jun 8 08:31:54 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.2 Maintainer: curcio_it Status: ready --> +<!-- EN-Revision: 1.6 Maintainer: curcio_it Status: ready --> <refentry id="function.xslt-errno"> <refnamediv> <refname>xslt_errno</refname> @@ -16,6 +16,12 @@ processore XSLT indicato. </para> </refsect1> + <refsect1> + &reftitle.seealso; + <para> + <function>xslt_error</function>. + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/diff.php/phpdoc-it/reference/xslt/functions/xslt-error.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-it/reference/xslt/functions/xslt-error.xml diff -u phpdoc-it/reference/xslt/functions/xslt-error.xml:1.4 phpdoc-it/reference/xslt/functions/xslt-error.xml:1.5 --- phpdoc-it/reference/xslt/functions/xslt-error.xml:1.4 Wed May 1 15:16:18 2002 +++ phpdoc-it/reference/xslt/functions/xslt-error.xml Wed Jun 8 08:31:54 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.2 Maintainer: curcio_it Status: ready --> +<!-- EN-Revision: 1.7 Maintainer: curcio_it Status: ready --> <refentry id="function.xslt-error"> <refnamediv> <refname>xslt_error</refname> @@ -15,13 +15,15 @@ Restituisce una stringa che descrive l'ultimo errore restituito dal processore XSLT indicato. </para> - <para> - <example> - <title> + </refsect1> + <refsect1> + &reftitle.examples + <example> + <title> Gli errori di Handling usano le funzioni <function>xslt_error</function> e <function>xslt_errno</function>. - </title> - <programlisting role="php"> + </title> + <programlisting role="php"> <![CDATA[ <?php @@ -32,13 +34,18 @@ xslt_errno($xh), xslt_error($xh))); } -print($result); +echo $result; xslt_free($xh); ?> ]]> - </programlisting> - </example> + </programlisting> + </example> + </refsect1> + <refsect1> + &reftitle.seealso; + <para> + <function>xslt_errno</function>. </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/xslt/functions/xslt-free.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-it/reference/xslt/functions/xslt-free.xml diff -u phpdoc-it/reference/xslt/functions/xslt-free.xml:1.4 phpdoc-it/reference/xslt/functions/xslt-free.xml:1.5 --- phpdoc-it/reference/xslt/functions/xslt-free.xml:1.4 Wed May 1 15:16:18 2002 +++ phpdoc-it/reference/xslt/functions/xslt-free.xml Wed Jun 8 08:31:54 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.2 Maintainer: curcio_it Status: ready --> +<!-- EN-Revision: 1.4 Maintainer: curcio_it Status: ready --> <refentry id="function.xslt-free"> <refnamediv> <refname>xslt_free</refname> @@ -15,6 +15,12 @@ Libera il processore XSLT identificato dall'handle dato. </para> </refsect1> + <refsect1> + &reftitle.seealso; + <para> + <function>xslt_create</function> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/diff.php/phpdoc-it/reference/xslt/functions/xslt-process.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-it/reference/xslt/functions/xslt-process.xml diff -u phpdoc-it/reference/xslt/functions/xslt-process.xml:1.4 phpdoc-it/reference/xslt/functions/xslt-process.xml:1.5 --- phpdoc-it/reference/xslt/functions/xslt-process.xml:1.4 Wed May 1 15:16:18 2002 +++ phpdoc-it/reference/xslt/functions/xslt-process.xml Wed Jun 8 08:31:54 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.2 Maintainer: curcio_it Status: ready --> +<!-- EN-Revision: 1.17 Maintainer: curcio_it Status: ready --> <refentry id="function.xslt-process"> <refnamediv> <refname>xslt_process</refname> @@ -10,18 +10,35 @@ <methodsynopsis> <type>mixed</type><methodname>xslt_process</methodname> <methodparam><type>resource</type><parameter>xh</parameter></methodparam> - <methodparam><type>string</type><parameter>xml</parameter></methodparam> - <methodparam><type>string</type><parameter>xsl</parameter></methodparam> - <methodparam choice="opt"><type>string</type><parameter>result</parameter></methodparam> + <methodparam><type>string</type><parameter>xmlcontainer</parameter></methodparam> + <methodparam><type>string</type><parameter>xslcontainer</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>resultcontainer</parameter></methodparam> <methodparam choice="opt"><type>array</type><parameter>arguments</parameter></methodparam> <methodparam choice="opt"><type>array</type><parameter>parameters</parameter></methodparam> </methodsynopsis> <para> - La funzione xslt_process() è una delle più importanti della nuova estensione XSLT. - Permette di eseguire una trasformazione XSLT usando quasi ogni tipo di - fonte per l'input. Questa è un completamento mediante l'uso dell'argomento + La funzione <function>xslt_process</function> è una delle più importanti della + nuova estensione XSLT. Permette di eseguire una trasformazione XSLT usando quasi ogni tipo di + fonte per l'input - i contenitori. Questa è un completamento mediante l'uso dell'argomento buffers -- un concetto preso dal processore XSLT Sablotron (attualmente l'unico processore XSLT supportato da questa estensione). + Il contenituore di input di default è il nome del file del documento + trasformato. Se il contenitore di destinaizone non viene fornito, ad esempio + è impostato a &null; - alla la funzione restituisce il risultato. + </para> + <para> + <warning> + <simpara> + Questa funzione ha modifica i propri argomenti dalla versione 4.0.6. Infatti non + fornire più il contenuto XML o XSL come secondi e terzi argomenti, poichè questi + creano un segmentation fault in Sablotron fino alla versione + 0.95 inclusa. + </simpara> + </warning> + </para> + <para> + I contenitori possono essere impostati anche tramite la matrice + <parameter>$arguments</parameter> (vedere più avanti). </para> <para> Il più semplice tipo di trasformazione con la funzione <function>xslt_process</function> @@ -41,16 +58,15 @@ // Process the document if (xslt_process($xh, 'sample.xml', 'sample.xsl', 'result.xml')) { - print "SUCCESS, sample.xml was transformed by sample.xsl into result.xml"; - print ", result.xml has the following contents\n<br>\n"; - print "<pre>\n"; + echo "SUCCESS, sample.xml was transformed by sample.xsl into result.xml"; + echo ", result.xml has the following contents\n<br />\n"; + echo "<pre>\n"; readfile('result.xml'); - print "</pre>\n"; -} -else { - print "Sorry, sample.xml could not be transformed by sample.xsl into"; - print " result.xml the reason is that " . xslt_error($xh) . " and the "; - print "error code is " . xslt_errno($xh); + echo "</pre>\n"; +} else { + echo "Sorry, sample.xml could not be transformed by sample.xsl into"; + echo " result.xml the reason is that " . xslt_error($xh) . " and the "; + echo "error code is " . xslt_errno($xh); } xslt_free($xh); @@ -80,16 +96,15 @@ // Process the document, returning the result into the $result variable $result = xslt_process($xh, 'sample.xml', 'sample.xsl'); if ($result) { - print "SUCCESS, sample.xml was transformed by sample.xsl into the \$result"; - print " variable, the \$result variable has the following contents\n<br>\n"; - print "<pre>\n"; - print $result; - print "</pre>\n"; -} -else { - print "Sorry, sample.xml could not be transformed by sample.xsl into"; - print " the \$result variable the reason is that " . xslt_error($xh) . - print " and the error code is " . xslt_errno($xh); + echo "SUCCESS, sample.xml was transformed by sample.xsl into the \$result"; + echo " variable, the \$result variable has the following contents\n<br />\n"; + echo "<pre>\n"; + echo $result; + echo "</pre>\n"; +} else { + echo "Sorry, sample.xml could not be transformed by sample.xsl into"; + echo " the \$result variable the reason is that " . xslt_error($xh) . + echo " and the error code is " . xslt_errno($xh); } xslt_free($xh); @@ -131,16 +146,15 @@ // Process the document $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments); if ($result) { - print "SUCCESS, sample.xml was transformed by sample.xsl into the \$result"; - print " variable, the \$result variable has the following contents\n<br>\n"; - print "<pre>\n"; - print $result; - print "</pre>\n"; -} -else { - print "Sorry, sample.xml could not be transformed by sample.xsl into"; - print " the \$result variable the reason is that " . xslt_error($xh) . - print " and the error code is " . xslt_errno($xh); + echo "SUCCESS, sample.xml was transformed by sample.xsl into the \$result"; + echo " variable, the \$result variable has the following contents\n<br />\n"; + echo "<pre>\n"; + echo $result; + echo "</pre>\n"; +} else { + echo "Sorry, sample.xml could not be transformed by sample.xsl into"; + echo " the \$result variable the reason is that " . xslt_error($xh) . + echo " and the error code is " . xslt_errno($xh); } xslt_free($xh); ?> @@ -149,10 +163,69 @@ </example> </para> <para> - Finalmente, l'ultimo argomento della funzione <function>xslt_process</function> è dei parametri - che vuoi passare al documento XSLT. Questi parametri possono avere poi accesso tramite - i tuoi files XSL usando l'istruzione &lt;xsl:param name=&quot;parameter_name&quot;&gt;. + Finalmente, l'ultimo argomento della funzione <function>xslt_process</function> + rappresenta una matrice di qualsiasi parametro di alto livello che si desidera + passare al documento XSLT. Questi parametri possono essere referenziati + dal file XSL utilizzando l'istruzione &lt;xsl:param name=&quot;parameter_name&quot;&gt;. + I parametri devono avere la codifica UTF-8 ed i rispettivi valori devono + essere interpretati come stringhe dal processore <productname>Sablotron</productname>. + In altre parole non si possono passare come parametri al documento XSLT dei node-set. + </para> + <para> + <example> + <title>Passaggio di variabili PHP al file XSL</title> + <programlisting role="php"> +<![CDATA[ +<?php + +// XML string +$xml = '<?xml version="1.0"?> +<para> + change me +</para>'; + +// stringa XSL +$xsl = ' +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:output method="html" encoding="ISO-8859-1" indent="no" + omit-xml-declaration="yes" media-type="text/html"/> + <xsl:param name="myvar"/> + <xsl:param name="mynode"/> + <xsl:template match="/"> +My PHP variable : <xsl:value-of select="$myvar"/><br /> +My node set : <xsl:value-of select="$mynode"/> + </xsl:template> +</xsl:stylesheet>'; + + +$xh = xslt_create(); + +// Il secondo parametro sarà interpretato come stringa +$parameters = array ( + 'myvar' => 'test', + 'mynode' => '<foo>bar</foo>' +); + +$arguments = array ( + '/_xml' => $xml, + '/_xsl' => $xsl +); + +echo xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments, $parameters); + +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +My PHP variable : test<br> +My node set : &lt;foo&gt;bar&lt;/foo&gt; +]]> + </screen> + </example> </para> + &note.xslt.windows; </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/xslt/functions/xslt-set-base.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-it/reference/xslt/functions/xslt-set-base.xml diff -u phpdoc-it/reference/xslt/functions/xslt-set-base.xml:1.4 phpdoc-it/reference/xslt/functions/xslt-set-base.xml:1.5 --- phpdoc-it/reference/xslt/functions/xslt-set-base.xml:1.4 Wed May 1 15:16:18 2002 +++ phpdoc-it/reference/xslt/functions/xslt-set-base.xml Wed Jun 8 08:31:54 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.2 Maintainer: curcio_it Status: ready --> +<!-- EN-Revision: 1.5 Maintainer: curcio_it Status: ready --> <refentry id="function.xslt-set-base"> <refnamediv> <refname>xslt_set_base</refname> @@ -15,8 +15,14 @@ <para> Imposta l'URI di base per tutte le trasformazioni XSLT, l'URI di base è usato con le istruzioni Xpath per la risoluzione di document() e di altri comandi che - accedono a risorse esterne. + accedono a risorse esterne. Viene utilizzato, inoltre, per risolvere gli URI degli + elementi &lt;xsl:include&gt; ed &lt;xsl:import&gt; </para> + <para> + Dalla versione 4.3, la base di default per l'URI è la directory di esecuzione dello script. Infatti è la + directory indicata dalla costante <constant>__FILE__</constant>. Prima delle versione 4.3, la base di default per l'URI era meno prevedibile. + </para> + &note.xslt.windows; </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-it/reference/xslt/functions/xslt-set-encoding.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-it/reference/xslt/functions/xslt-set-encoding.xml diff -u phpdoc-it/reference/xslt/functions/xslt-set-encoding.xml:1.4 phpdoc-it/reference/xslt/functions/xslt-set-encoding.xml:1.5 --- phpdoc-it/reference/xslt/functions/xslt-set-encoding.xml:1.4 Wed May 1 15:16:18 2002 +++ phpdoc-it/reference/xslt/functions/xslt-set-encoding.xml Wed Jun 8 08:31:54 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.2 Maintainer: curcio_it Status: ready --> +<!-- EN-Revision: 1.3 Maintainer: curcio_it Status: ready --> <refentry id="function.xslt-set-encoding"> <refnamediv> <refname>xslt_set_encoding</refname> @@ -14,8 +14,9 @@ </methodsynopsis> <para> Imposta l'output encoding per le trasformazioni XSLT. Quando è usato il - Sablotron backend quasta opzione è disponibile solo quando compili - Sablotron con il supporto per l'encoding. + <productname>Sablotron</productname> backend quasta opzione è disponibile solo quando compili + <productname>Sablotron</productname> con il supporto + per l'encoding. </para> </refsect1> </refentry>
« previous php.doc.it (#734) next »