cortesi Wed Apr 10 19:31:42 2002 EDT Modified files: /phpdoc/it/functions xslt.xml Log: adding translation by curcio_it up to EN 1.32
Index: phpdoc/it/functions/xslt.xml diff -u /dev/null phpdoc/it/functions/xslt.xml:1.5 --- /dev/null Wed Apr 10 19:31:42 2002 +++ phpdoc/it/functions/xslt.xml Wed Apr 10 19:31:40 2002 @@ -0,0 +1,583 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- EN-Revision: 1.32 Maintainer: curcio_it Status: ready --> + <reference id="ref.xslt"> + <title>Funzioni XSLT</title> + <titleabbrev>XSLT</titleabbrev> + + <partintro> + <sect1 id="xslt.partintro"> + <title>Introduzione</title> + + <sect2 id="xslt.intro"> + <title>Circa XSLT e Sablotron</title> + <para> + XSLT (Extensible Stylesheet Language (XSL) + Transformations) è un linguaggio per trasformare documenti XML in + altri documenti XML. E' uno standard + definito dal World Wide Web consortium (W3C). + Informazioni circa l' XSLT e le relative tecnologie possono essere + trovate su <ulink url="&url.xslt;">&url.xslt;</ulink>. + </para> + </sect2> + + <sect2 id="xslt.install"> + <title>Installazione</title> + <para> + Questa estensione usa <productname>Sablotron</productname> + e <productname>expat</productname>, i quali possono essere entrambi + trovati su <ulink + url="&url.sablotron;">&url.sablotron;</ulink>. I binari + sono forniti assieme al codice sorgente. + </para> + <para> + Su UNIX, fai partire <command>configure</command> con l'opzione <option + role="configure">--enable-xslt --with-xslt-sablot</option> + . La libreria <productname>Sablotron</productname> dovrebbe + essere installata da qualche parte dove il compilatore può trovarla. + </para> + </sect2> + + <sect2 id="xslt.about"> + <title>Circa questa estensione</title> + <para> + L'estensione PHP fornisce un processore indipendente API alle trasformazioni + XSLT. Attualmente questa estensione supporta solo la libreria + Sablotron della Ginger Alliance. Il supporto è pianificato per le altre + librerie, come la libreria Xalan o la libreria libxslt. + </para> + <note> + <simpara> + Questa estensione è differenta dall'estensione sablotron distribuita con + le versioni del PHP precedenti PHP 4.1, attualmente è supportata nel PHP 4.1 + solo la nuova estensione XSLT. Se hai bisogno di supporto per le vecchie +estensioni, fai la tua domanda + sulla mailing list [EMAIL PROTECTED] + </simpara> + </note> + </sect2> + + </sect1> + </partintro> + + <refentry id="function.xslt-set-log"> + <refnamediv> + <refname>xslt_set_log</refname> + <refpurpose>Imposta il file di log per scrivere il messaggio di log a</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>void</type><methodname>xslt_set_log</methodname> + <methodparam><type>resource</type><parameter>xh</parameter></methodparam> + <methodparam><type>mixed</type><parameter>log</parameter></methodparam> + </methodsynopsis> + <para> + <variablelist> + <varlistentry> + <term><parameter>xh</parameter></term> + <listitem> + <simpara> + Un riferimento all'XSLT parser. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>log</parameter></term> + <listitem> + <simpara> + Questo parametro è o un valore booleano che può essere settato su on o off, +oppure una + stringa contenente il file di log incluso dei log di errore. + </simpara> + </listitem> + </varlistentry> + </variablelist></para> + <para> + Questa funzione permette di impostare il file nel quale vuoi i messaggi di log di +XSLT, + i messaggi di log di XSLT sono differenti dagli altri messaggi di errore, nei +quali messaggi di log non siano + presenti i messaggi di errore ma piuttosto messaggi inerenti allo stato del +processore di XSLT. + Sono usati per il debugging dell'XSLT, quando qualcosa va storto. + </para> + <para> + Per default il logging è disabilitato, ma se vuoi abilitarlo devi prima richiamare + <function>xslt_set_log</function> con un parametro booleano il quale abilita il +logging, poi se + vuoi impostare il file di log per fare il debug, devi poi passargli una stringa +contenente il + nome del file: + <example> + <title> + Uso delle features del Logging di XSLT + </title> + <programlisting role="php"> +<![CDATA[ +<?php + +$xh = xslt_create(); +xslt_set_log($xh, true); +xslt_set_log($xh, getcwd() . 'myfile.log'); + +$result = xslt_process($xh, 'dog.xml', 'pets.xsl'); +print($result); + +xslt_free($xh); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + </refentry> + + <refentry id="function.xslt-create"> + <refnamediv> + <refname>xslt_create</refname> + <refpurpose>Crea un nuovo processore XSLT.</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>resource</type><methodname>xslt_create</methodname> + <void/> + </methodsynopsis> + <para> + Crea e restituisce un nuovo processore XSLT riorsa per la modifica dalle + altre funzioni XSLT. + </para> + </refsect1> + </refentry> + + <refentry id="function.xslt-errno"> + <refnamediv> + <refname>xslt_errno</refname> + <refpurpose>Restituisce un numero di errore</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>int</type><methodname>xslt_errno</methodname> + <methodparam><type>resource</type><parameter>xh</parameter></methodparam> + </methodsynopsis> + <para> + Restituisce un codice di errore che descrive l'ultimo errore successo sul + processore XSLT indicato. + </para> + </refsect1> + </refentry> + + <refentry id="function.xslt-error"> + <refnamediv> + <refname>xslt_error</refname> + <refpurpose>Restituisce una stringa di errore</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>mixed</type><methodname>xslt_error</methodname> + <methodparam><type>resource</type><parameter>xh</parameter></methodparam> + </methodsynopsis> + <para> + Restituisce una stringa che descrive l'ultimo errore successo sul + processore XSLT indicato. + </para> + <para> + <example> + <title> + Gli errori di Handling usano le funzioni <function>xslt_error</function> e + <function>xslt_errno</function>. + </title> + <programlisting role="php"> +<![CDATA[ +<?php + +$xh = xslt_create(); +$result = xslt_process($xh, 'dog.xml', 'pets.xsl'); +if (!$result) { + die(sprintf("Cannot process XSLT document [%d]: %s", + xslt_errno($xh), xslt_error($xh))); +} + +print($result); + +xslt_free($xh); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + </refentry> + + <refentry id="function.xslt-free"> + <refnamediv> + <refname>xslt_free</refname> + <refpurpose>Processore XSLT libero</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>void</type><methodname>xslt_free</methodname> + <methodparam><type>resource</type><parameter>xh</parameter></methodparam> + </methodsynopsis> + <para> + Libera il processore XSLT identificato dall'handle dato. + </para> + </refsect1> + </refentry> + + <refentry id="function.xslt-process"> + <refnamediv> + <refname>xslt_process</refname> + <refpurpose>Esegue una trasformazione XSLT</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <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 +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 di input. Questa è un completamente attraverso l'uso dell'argomento + buffers -- un concetto proso dal processore XSLT Sablotron + (attualmente l'unico processore XSLT che questa estensione supporta). + </para> + <para> + Il più semplice tipo di trasformazione con la funzione +<function>xslt_process()</function> + è la trasformazione di un file XML con un file XSLT, mettendo il + risultato in un terzo file contenente un nuovo documento XML (o HTML). + Fare questo con sablotron è davvero molto semplice... + </para> + <example> + <title>Uso di <function>xslt_process</function> per trasformare un file XML e un +file XSL + in un nuovo file XML</title> + <programlisting role="php"> +<![CDATA[ +<?php + +// Allocate a new XSLT processor +$xh = xslt_create(); + +// 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"; + 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); +} + +xslt_free($xh); + +?> +]]> + </programlisting> + </example> + <para> + Mentre questa funzionalità è importante, a volte, specialmente in un ambiente +web, si vorrebbe + avere la possibilità di stampare a video il risultato direttamente. Quindi, se +si omette il terzo argomento + alla funzione <function>xslt_process</function> (o inserire il valore NULL oer +l'argomento), lo script + restituirà automaticamente il valore della trasformazione dell'XSLT, invece di +scriverlo in un + file... + </para> + <para> + <example> + <title>Uso di <function>xslt_process</function> per trasformare un file XML e +uno XSL + in una variabile contenente i dati XML restituiti</title> + <programlisting role="php"> +<![CDATA[ +<?php + +// Allocate a new XSLT processor +$xh = xslt_create(); + +// 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); +} + +xslt_free($xh); + +?> +]]> + </programlisting> + </example> + </para> + <para> + I due casi sopra sono i due casi più semplici che ci sono quando c'è una +trasformazione XSLT + e c'è da dire che dovreste essere per la maggior parte delle volte in questi +casi, ma, a volte, puoi prendere il tuo + codice XML e XSLT da fonti esterne, come database e socket. In questi casi, avrai + i dati XML e/o XSLT in una variabile -- e nella produzione di applicazioni +l'overhead per scaricare + questo codice al file potrebbere essere eccessivo. Questo è dove la sintassi +"argument" dell'XSLT, viene al + salvataggio. Invece dei file come argomenti XML e XSLT alla funzione +<function>xslt_process</function>, + puoi specificare l' "argument place holders" il quale è poi sostituito +dal valore + dato nell'argomento dell'array (il quinto parametro della funzione +<function>xslt_process</function>). + Di seguito c'è un esempio del processo di inserimento di codice XML e XSLT senza + l'ausilio di file. + </para> + <para> + <example> + <title>Uso di <function>xslt_process</function> per trasformare una variabile +contenente dati XML + e una variabile contenente dati XSL in una variabile contenente i dati XML +risultati</title> + <programlisting role="php"> +<![CDATA[ +<?php +// $xml and $xsl contain the XML and XSL data + +$arguments = array( + '/_xml' => $xml, + '/_xsl' => $xsl +); + +// Allocate a new XSLT processor +$xh = xslt_create(); + +// 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); +} +xslt_free($xh); +?> +]]> + </programlisting> + </example> + </para> + <para> + Finalmente, l'ultimo argomento della funzione <function>xslt_process</function> +è dei parametri + che vuoi passare al documento XSLT. Questi parametri possono poi essere acceduti +con + i tuoi files XSL usando l'istruzione <xsl:param +name="parameter_name">. + </para> + </refsect1> + </refentry> + + <refentry id="function.xslt-set-sax-handler"> + <refnamediv> + <refname>xslt_set_sax_handler</refname> + <refpurpose>Imposta un handlers SAX per un processore XSLT</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>void</type><methodname>xslt_set_sax_handler</methodname> + <methodparam><type>resource</type><parameter>xh</parameter></methodparam> + <methodparam><type>array</type><parameter>handlers</parameter></methodparam> + </methodsynopsis> + <para> + Imposta una handlers SAX sull'handle resource data da + <parameter>xh</parameter>. L'handlers SAX può avere un array bi-dimensionale + con il formato (tutti gli elementi al livello top sono opzionali): + <informalexample> + <programlisting role="php"> +<![CDATA[ +array( +[document] => + array( + start document handler, + end document handler + ), +[element] => + array( + start element handler, + end element handler + ), +[namespace] => + array( + start namespace handler, + end namespace handler + ), +[comment] => comment handler, +[pi] => processing instruction handler, +[character] => character data handler +) +]]> + </programlisting> + </informalexample> + </para> + </refsect1> + </refentry> + + <refentry id="function.xslt-set-scheme-handler"> + <refnamediv> + <refname>xslt_set_scheme_handler</refname> + <refpurpose>Imposta lo schema dell'handlers per un processore XSLT</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>void</type><methodname>xslt_set_scheme_handler</methodname> + <methodparam><type>resource</type><parameter>xh</parameter></methodparam> + <methodparam><type>array</type><parameter>handlers</parameter></methodparam> + </methodsynopsis> + <para> + Imposta lo schema dell'handlers sull'handle resource data da + <parameter>xh</parameter>. Lo schema dell'handlers può essere un array con il + formato (tutti gli elementi sono opzionali): + <informalexample> + <programlisting role="php"> +<![CDATA[ +array( +[get_all] => get all handler, +[open] => open handler, +[get] => get handler, +[put] => put handler, +[close] => close handler +) +]]> + </programlisting> + </informalexample> + </para> + </refsect1> + </refentry> + + <refentry id="function.xslt-set-error-handler"> + <refnamediv> + <refname>xslt_set_error_handler</refname> + <refpurpose>Imposta un error handler per un processore XSLT</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>void</type><methodname>xslt_set_error_handler</methodname> + <methodparam><type>resource</type><parameter>xh</parameter></methodparam> + <methodparam><type>mixed</type><parameter>handler</parameter></methodparam> + </methodsynopsis> + <para> + Imposta una funzione di error handler per il processore XSLT dato da +<parameter>xh</parameter>, + questa funzione sarà richiamata quando ha luogo un errore nella trasformazione +XSLT + (questa funzione è anche chiamata per le notizie). + </para> + </refsect1> + </refentry> + + <refentry id="function.xslt-set-base"> + <refnamediv> + <refname>xslt_set_base</refname> + <refpurpose>Imposta l'URI di base per tuttte le trasformazioni XSLT</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>void</type><methodname>xslt_set_base</methodname> + <methodparam><type>resource</type><parameter>xh</parameter></methodparam> + <methodparam><type>string</type><parameter>uri</parameter></methodparam> + </methodsynopsis> + <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. + </para> + </refsect1> + </refentry> + + <refentry id="function.xslt-set-encoding"> + <refnamediv> + <refname>xslt_set_encoding</refname> + <refpurpose>Imposta l'encoding per il parsing dei documenti XML</refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>void</type><methodname>xslt_set_encoding</methodname> + <methodparam><type>resource</type><parameter>xh</parameter></methodparam> + <methodparam><type>string</type><parameter>encoding</parameter></methodparam> + </methodsynopsis> + <para> + Imposta l'output encoding per le trasformazioni XSLT. Quando è usato il + Sablotron backend quasta opzione è disponibile solo qualndo compili + Sablotron con il supporto per l'encoding. + </para> + </refsect1> + </refentry> + + <refentry id='function.xslt-set-sax-handlers'> + <refnamediv> + <refname>xslt_set_sax_handlers</refname> + <refpurpose> + Imposta l'handlers SAX da richiamare quando il document XML viene processato + </refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>void</type><methodname>xslt_set_sax_handlers</methodname> + <methodparam><type>resource</type><parameter>processor</parameter></methodparam> + <methodparam><type>array</type><parameter>handlers</parameter></methodparam> + </methodsynopsis> + <para> + &warn.undocumented.func; + </para> + </refsect1> + </refentry> + + + + <refentry id='function.xslt-set-scheme-handlers'> + <refnamediv> + <refname>xslt_set_scheme_handlers</refname> + <refpurpose> + Imposta lo schema dell'handlers per un processore XSLT + </refpurpose> + </refnamediv> + <refsect1> + <title>Descrizione</title> + <methodsynopsis> + <type>void</type><methodname>xslt_set_scheme_handlers</methodname> + <methodparam><type>resource</type><parameter>processor</parameter></methodparam> + <methodparam><type>array</type><parameter>handlers</parameter></methodparam> + </methodsynopsis> + <para> + &warn.undocumented.func; + </para> + </refsect1> + </refentry> + + + </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 +-->