From 1fb9a518b4978688cf60d880e9d801cb9d653f13 Mon Sep 17 00:00:00 2001 From: Hannes Magnusson Date: Sun, 23 Dec 2007 21:58:21 +0000 Subject: [PATCH] Rename files (from functions/) # NOTE: *NO* content or ID change git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@248877 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/xsl/xsltprocessor/construct.xml | 66 ++++++++ reference/xsl/xsltprocessor/getparameter.xml | 83 ++++++++++ .../xsl/xsltprocessor/hasexsltsupport.xml | 72 +++++++++ .../xsl/xsltprocessor/importstylesheet.xml | 64 ++++++++ .../xsltprocessor/registerphpfunctions.xml | 141 +++++++++++++++++ .../xsl/xsltprocessor/removeparameter.xml | 83 ++++++++++ reference/xsl/xsltprocessor/setparameter.xml | 145 ++++++++++++++++++ .../xsl/xsltprocessor/transformtodoc.xml | 109 +++++++++++++ .../xsl/xsltprocessor/transformtouri.xml | 110 +++++++++++++ .../xsl/xsltprocessor/transformtoxml.xml | 111 ++++++++++++++ 10 files changed, 984 insertions(+) create mode 100644 reference/xsl/xsltprocessor/construct.xml create mode 100644 reference/xsl/xsltprocessor/getparameter.xml create mode 100644 reference/xsl/xsltprocessor/hasexsltsupport.xml create mode 100644 reference/xsl/xsltprocessor/importstylesheet.xml create mode 100644 reference/xsl/xsltprocessor/registerphpfunctions.xml create mode 100644 reference/xsl/xsltprocessor/removeparameter.xml create mode 100644 reference/xsl/xsltprocessor/setparameter.xml create mode 100644 reference/xsl/xsltprocessor/transformtodoc.xml create mode 100644 reference/xsl/xsltprocessor/transformtouri.xml create mode 100644 reference/xsl/xsltprocessor/transformtoxml.xml diff --git a/reference/xsl/xsltprocessor/construct.xml b/reference/xsl/xsltprocessor/construct.xml new file mode 100644 index 0000000000..61a5692924 --- /dev/null +++ b/reference/xsl/xsltprocessor/construct.xml @@ -0,0 +1,66 @@ + + + + + XSLTProcessor::__construct + Creates a new XSLTProcessor object + + + &reftitle.description; + + XSLTProcessor + + __construct + + + + + Creates a new XSLTProcessor object. + + + + &reftitle.examples; + + + Creating an <classname>XSLTProcessor</classname> + +load($xsl_filename); +$xsl->importStyleSheet($doc); + +$doc->load($xml_filename); +echo $xsl->transformToXML($doc); + +?> +]]> + + + + + + + diff --git a/reference/xsl/xsltprocessor/getparameter.xml b/reference/xsl/xsltprocessor/getparameter.xml new file mode 100644 index 0000000000..3b37214327 --- /dev/null +++ b/reference/xsl/xsltprocessor/getparameter.xml @@ -0,0 +1,83 @@ + + + + + XSLTProcessor::getParameter + Get value of a parameter + + + &reftitle.description; + + XSLTProcessor + + string + getParameter + stringnamespaceURI + stringlocalName + + + + Gets a parameter if previously set by . + + + + &reftitle.parameters; + + + + namespaceURI + + + The namespace URI of the XSLT parameter. + + + + + localName + + + The local name of the XSLT parameter. + + + + + + + + &reftitle.returnvalues; + + The value of the parameter or &null; if it's not set. + + + + &reftitle.seealso; + + + + + + + + + + diff --git a/reference/xsl/xsltprocessor/hasexsltsupport.xml b/reference/xsl/xsltprocessor/hasexsltsupport.xml new file mode 100644 index 0000000000..723da7fb48 --- /dev/null +++ b/reference/xsl/xsltprocessor/hasexsltsupport.xml @@ -0,0 +1,72 @@ + + + + + XSLTProcessor::hasExsltSupport + Determine if PHP has EXSLT support + + + &reftitle.description; + + XSLTProcessor + + bool + hasExsltSupport + + + + + This method determine if PHP was built with the EXSLT library. + + + + &reftitle.returnvalues; + + &return.success; + + + + &reftitle.examples; + + + Testing EXSLT support + +hasExsltSupport()) { + die('EXSLT support not available'); +} + +// do EXSLT stuff here .. + +?> +]]> + + + + + + + diff --git a/reference/xsl/xsltprocessor/importstylesheet.xml b/reference/xsl/xsltprocessor/importstylesheet.xml new file mode 100644 index 0000000000..994fc754df --- /dev/null +++ b/reference/xsl/xsltprocessor/importstylesheet.xml @@ -0,0 +1,64 @@ + + + + + XSLTProcessor::importStylesheet + Import stylesheet + + + &reftitle.description; + + XSLTProcessor + + voidimportStylesheet + DOMDocumentstylesheet + + + + This method import the stylesheet into the + XSLTProcessor for transformations. + + + + &reftitle.parameters; + + + + stylesheet + + + The imported style sheet as a DOMDocument object. + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + diff --git a/reference/xsl/xsltprocessor/registerphpfunctions.xml b/reference/xsl/xsltprocessor/registerphpfunctions.xml new file mode 100644 index 0000000000..6b8b94d469 --- /dev/null +++ b/reference/xsl/xsltprocessor/registerphpfunctions.xml @@ -0,0 +1,141 @@ + + + + + XSLTProcessor::registerPHPFunctions + Enables the ability to use PHP functions as XSLT functions + + + &reftitle.description; + + XSLTProcessor + + void + registerPHPFunctions + mixedrestrict + + + + This method enables the ability to use PHP functions as XSLT functions + within XSL stylesheets. + + + + &reftitle.parameters; + + + + restrict + + + Use this parameter to only allow certain functions to be called from + XSLT. + + + This parameter can be either a string (a function name) or an array of + functions. + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + &reftitle.examples; + + + Simple PHP Function call from a stylesheet + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; +$xmldoc = DOMDocument::loadXML($xml); +$xsldoc = DOMDocument::loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); +echo $proc->transformToXML($xmldoc); +?>]]>
+
+
+
+ + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 5.1.0 + + The restrict parameter was added. + + + + + + + +
+ + diff --git a/reference/xsl/xsltprocessor/removeparameter.xml b/reference/xsl/xsltprocessor/removeparameter.xml new file mode 100644 index 0000000000..8ec5f289ce --- /dev/null +++ b/reference/xsl/xsltprocessor/removeparameter.xml @@ -0,0 +1,83 @@ + + + + + XSLTProcessor::removeParameter + Remove parameter + + + &reftitle.description; + + XSLTProcessor + + bool + removeParameter + stringnamespaceURI + stringlocalName + + + + Removes a parameter, if set. This will make the processor use the + default value for the parameter as specified in the stylesheet. + + + + &reftitle.parameters; + + + + namespaceURI + + + The namespace URI of the XSLT parameter. + + + + + localName + + + The local name of the XSLT parameter. + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + &reftitle.seealso; + + + + + + + + + + diff --git a/reference/xsl/xsltprocessor/setparameter.xml b/reference/xsl/xsltprocessor/setparameter.xml new file mode 100644 index 0000000000..6e83be947e --- /dev/null +++ b/reference/xsl/xsltprocessor/setparameter.xml @@ -0,0 +1,145 @@ + + + + + XSLTProcessor::setParameter + Set value for a parameter + + + &reftitle.description; + + XSLTProcessor + + boolsetParameter + stringnamespace + stringname + stringvalue + + + + XSLTProcessor + + boolsetParameter + stringnamespace + arrayoptions + + + + Sets the value of one or more parameters to be used in subsequent + transformations with XSLTProcessor. If the + parameter doesn't exist in the stylesheet it will be ignored. + + + + &reftitle.parameters; + + + + namespace + + + The namespace URI of the XSLT parameter. + + + + + name + + + The local name of the XSLT parameter. + + + + + value + + + The new value of the XSLT parameter. + + + + + options + + + An array of name => value pairs. This syntax is + available since PHP 5.1.0. + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + &reftitle.examples; + + + Changing the owner before the transformation + + 'marc', + 'Olivier Parmentier' => 'olivier' +); + +$xsl = new DOMDocument; +$xsl->load('collection.xsl'); + +// Configure the transformer +$proc = new XSLTProcessor; +$proc->importStyleSheet($xsl); // attach the xsl rules + +foreach ($collections as $name => $file) { + // Load the XML source + $xml = new DOMDocument; + $xml->load('collection_' . $file . '.xml'); + + $proc->setParameter('', 'owner', $name); + $proc->transformToURI($xml, 'file:///tmp/' . $file . '.html'); +} + +?> +]]> + + + + + + &reftitle.seealso; + + + + + + + + + + diff --git a/reference/xsl/xsltprocessor/transformtodoc.xml b/reference/xsl/xsltprocessor/transformtodoc.xml new file mode 100644 index 0000000000..bdcc8695f6 --- /dev/null +++ b/reference/xsl/xsltprocessor/transformtodoc.xml @@ -0,0 +1,109 @@ + + + + + XSLTProcessor::transformToDoc + Transform to a DOMDocument + + + &reftitle.description; + + XSLTProcessor + + DOMDocument + transformToDoc + DOMNodedoc + + + + Transforms the source node to a DOMDocument applying + the stylesheet given by the method. + + + + &reftitle.parameters; + + + + doc + + + The node to be transformed. + + + + + + + + &reftitle.returnvalues; + + The resulting DOMDocument or &false; on error. + + + + &reftitle.examples; + + + Transforming to a DOMDocument + +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); + +?> +]]> + + &example.outputs; + + + + + + + + &reftitle.seealso; + + + + + + + + + + diff --git a/reference/xsl/xsltprocessor/transformtouri.xml b/reference/xsl/xsltprocessor/transformtouri.xml new file mode 100644 index 0000000000..40d83e66a8 --- /dev/null +++ b/reference/xsl/xsltprocessor/transformtouri.xml @@ -0,0 +1,110 @@ + + + + + XSLTProcessor::transformToURI + Transform to URI + + + &reftitle.description; + + XSLTProcessor + + int + transformToURI + DOMDocumentdoc + stringuri + + + + Transforms the source node to an URI applying the stylesheet given by the + method. + + + + &reftitle.parameters; + + + + doc + + + The transformed document. + + + + + uri + + + + + + + + + + &reftitle.returnvalues; + + Returns the number of bytes written or &false; if an error occurred. + + + + &reftitle.examples; + + + Transforming to a HTML file + +load('collection.xml'); + +$xsl = new DOMDocument; +$xsl->load('collection.xsl'); + +// Configure the transformer +$proc = new XSLTProcessor; +$proc->importStyleSheet($xsl); // attach the xsl rules + +$proc->transformToURI($xml, 'file:///tmp/out.html'); + +?> +]]> + + + + + + &reftitle.seealso; + + + + + + + + + + diff --git a/reference/xsl/xsltprocessor/transformtoxml.xml b/reference/xsl/xsltprocessor/transformtoxml.xml new file mode 100644 index 0000000000..2c52738d6e --- /dev/null +++ b/reference/xsl/xsltprocessor/transformtoxml.xml @@ -0,0 +1,111 @@ + + + + + XSLTProcessor::transformToXML + Transform to XML + + + &reftitle.description; + + XSLTProcessor + + string + transformToXML + DOMDocumentdoc + + + + Transforms the source node to a string applying the stylesheet given by + the method. + + + + &reftitle.parameters; + + + + doc + + + The transformed document. + + + + + + + + &reftitle.returnvalues; + + The result of the transformation as a string or &false; on error. + + + + &reftitle.examples; + + + Transforming to a string + +load('collection.xml'); + +$xsl = new DOMDocument; +$xsl->load('collection.xsl'); + +// Configure the transformer +$proc = new XSLTProcessor; +$proc->importStyleSheet($xsl); // attach the xsl rules + +echo $proc->transformToXML($xml); + +?> +]]> + + &example.outputs; + +Fight for your mind

by Ben Harper - 1995


+

Electric Ladyland

by Jimi Hendrix - 1997


+]]> +
+
+
+
+ + &reftitle.seealso; + + + + + + + +
+ +