diff --git a/reference/xsl/functions/xsl-xsltprocessor-get-parameter.xml b/reference/xsl/functions/xsl-xsltprocessor-get-parameter.xml index fb62698a7a..fecc862f93 100644 --- a/reference/xsl/functions/xsl-xsltprocessor-get-parameter.xml +++ b/reference/xsl/functions/xsl-xsltprocessor-get-parameter.xml @@ -1,31 +1,65 @@ - - - - xsl_xsltprocessor_get_parameter - Get value of a parameter - - - Description - Procedural style - - stringxsl_xsltprocessor_get_parameter - stringnamespace - stringname - - Object oriented style (method) - - xsltprocessor - - string - getParameter - stringnamespace - stringname - - - &warn.undocumented.func; - - + + + + 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; + + + + + + + + - - - xsl_xsltprocessor_has_exslt_support - Determine if PHP has EXSLT support - - - Description - Procedural style - - boolxsl_xsltprocessor_has_exslt_support - - - Object oriented style (method) - - xsltprocessor - - bool - hasExsltSupport - - - - - xsl_xsltprocessor_has_exslt_support returns &true; - if PHP was built with the EXSLT library - , &false; otherwise. - - - - <function>xsl_xsltprocessor_has_exslt_support</function> Example - + + + + 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'); } @@ -42,11 +44,11 @@ if (!$proc->hasExsltSupport()) { ?> ]]> - - - - - + + + + + - - - xsl_xsltprocessor_import_stylesheet - Import stylesheet - - - Description - Procedural style - - boolxsl_xsltprocessor_import_stylesheet - XSLTProcessorxsl - objectindex - - Object oriented style (method) - - xsltprocessor - - bool - importStylesheet - objectindex - - - &warn.undocumented.func; - - + + + + XSLTProcessor->importStylesheet() + Import stylesheet + + + &reftitle.description; + + XSLTProcessor + + + importStylesheet + 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; + + + - - - xsl_xsltprocessor_register_php_functions - Enables the ability to use PHP functions as XSLT functions - - - Description - Procedural style - - voidxsl_xsltprocessor_register_php_functions - - - Object oriented style (method) - - xsltprocessor - - void - registerPHPFunctions - - - - - xsl_xsltprocessor_register_php_functions enables the - ability to use PHP functions as XSLT functions within XSL stylesheets. - - - + + + + XSLTProcessor->registerPHPFunctions() + Enables the ability to use PHP functions as XSLT functions + + + &reftitle.description; + + XSLTProcessor + + void + registerPHPFunctions + + + + + This method enables the ability to use PHP functions as XSLT functions + within XSL stylesheets. + + + + &reftitle.returnvalues; + + &return.void; + + + - - - xsl_xsltprocessor_remove_parameter - Remove parameter - - - Description - Procedural style - - boolxsl_xsltprocessor_remove_parameter - stringnamespace - stringname - - Object oriented style (method) - - xsltprocessor - - bool - removeParameter - stringnamespace - stringname - - - &warn.undocumented.func; - - + + + + 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; + + + + + + + + - - - xsl_xsltprocessor_set_parameter - Set value for a parameter - - - Description - Procedural style - - boolxsl_xsltprocessor_set_parameter - stringnamespace - stringname - stringvalue - - Object oriented style (method) - - xsltprocessor - - bool - setParameter - stringnamespace - stringname - stringvalue - - - &warn.undocumented.func; - - + + + + XSLTProcessor->setParameter() + Set value for a parameter + + + &reftitle.description; + + XSLTProcessor + + bool + setParameter + stringnamespace + mixedname + stringvalue + + + + 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; + + + + namespaceURI + + + The namespace URI of the XSLT parameter. + + + + + localName + + + The local name of the XSLT parameter. This can be either a string + representing the parameter name or an array of + name => value pairs. + + + + + value + + + The new value of the XSLT parameter. + + + + + + + + &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; + + + + + + + + - - - xsl_xsltprocessor_transform_to_doc - Transform to document - - - Description - Procedural style - - boolxsl_xsltprocessor_transform_to_doc - objectdoc - - Object oriented style (method) - - xsltprocessor - - bool - transformToDoc - objectdoc - - - &warn.undocumented.func; - - + + + + 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; + + + + + + + + - - - xsl_xsltprocessor_transform_to_uri - Transform to URI - - - Description - Procedural style - - boolxsl_xsltprocessor_transform_to_uri - objectdoc - stringuri - - Object oriented style (method) - - xsltprocessor - - bool - transformToUri - objectdoc - stringuri - - - &warn.undocumented.func; - - + + + + XSLTProcessor->transformToURI() + Transform to URI + + + 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 occured. + + + + &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; + + + + + + + + - - - xsl_xsltprocessor_transform_to_xml - Transform to XML - - - Description - Procedural style - - boolxsl_xsltprocessor_transform_to_xml - objectdoc - - Object oriented style (method) - - xsltprocessor - - bool - transformToXml - objectdoc - - - &warn.undocumented.func; - - + + + + 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; + + + + + + + +
+ XSL functions XSL @@ -9,13 +9,13 @@
&reftitle.intro; - The XSL extension implements the XSL standard, performing - XSLT transformations using the - libxslt library + The XSL extension implements the XSL standard, performing XSLT transformations using the libxslt library
-
+
&reftitle.required; This extension uses libxslt which can be @@ -26,94 +26,96 @@ &reference.xsl.configure; +
+ &reftitle.classes; + + + +
+ <classname>XSLTProcessor</classname> + + +
+ &reftitle.methods; + + + - Get value of a parameter + + + - Determine if PHP has EXSLT support + + + - Import stylesheet + + + - Enables the ability to use PHP functions as XSLT functions + + + - Remove parameter + + + - Set value for a parameter + + + - Transform to DOMDocument + + + - Transform to URI + + + - Transform to XML + + +
+
+
+
&reftitle.examples; - In this small tutorial we will learn how to transform an XML - document into HTML. + Many examples in this reference require both an XML and an XSL file. + We will use collection.xml and + collection.xsl that contains the following: - A simple XSL tree - - - - - Hey! Welcome to my sweet CD collection! - - - -

-

by

-

-

-
- -]]> -
-
-
- - - Corresponding XML tree + collection.xml - PHP Rock - Joe Coder - 2003 + Fight for your mind + Ben Harper + 1995 - Squashing Typos on a Winter's Eve - kennyt - 2004 + Electric Ladyland + Jimi Hendrix + 1997 ]]> - - - Making XML into HTML - - The following PHP code uses the XML and XSL extensions to - transform XML into presentable HTML. - - + collection.xsl + 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 -?> + + + + + Hey! Welcome to 's sweet CD collection! + + + +

+

by -

+
+
+
]]>
- - This should produce an HTML fragment similar to the following: - - -PHP Rock -

by Joe Coder

-

- 2003

- -

Squashing Typos on a Winter's Eve

-

by kennyt

-

- 2004

-]]> -