Rapide Advanced Adulte
 
 Web|Image|Shop|Video|News|Wmx|Mobile|Wiki|Ajouter ce moteur

     Manuel PHP     
Partager
 
 
Partager
Partager

 

Table :

.XSLTProcessor:: construct
.XSLTProcessor::getParameter
.XSLTProcessor::hasExsltSupport
.XSLTProcessor::importStylesheet
.XSLTProcessor::registerPHPFunctions
.XSLTProcessor::removeParameter
.XSLTProcessor::setParameter
.XSLTProcessor::transformToDoc
.XSLTProcessor::transformToURI
.XSLTProcessor::transformToXML
 
   

  xsl_xsltprocessor_register_php_functions  


XSLTProcessor::registerPHPFunctions

(no version information, might be only in CVS)

XSLTProcessor::registerPHPFunctions -- Active l'utilisation de PHP dans les feuilles de styles XSLT

Description

class XSLTProcessor {

void registerPHPFunctions ( [mixed restrict] )

}

Cette méthode permet d'utiliser les fonctions PHP en tant que fonctions XSLT dans les feuilles de style XSL.

Liste de paramètres

restrict

Utilisez ce paramètre pour restreindre les fonctions PHP accessibles depuis XSLT.

Ce paramètre peut être une chaîne (le nom d'une fonction) ou un tableau de noms de fonctions.

Valeurs de retour

Aucune valeur n'est retournée.

Exemples

Exemple 1. Appel d'une fonction PHP depuis une feuille de style

<?php
$xml
= <<<EOB
<allusers>
<user>
  <uid>bob</uid>
</user>
<user>
  <uid>joe</uid>
</user>
</allusers>
EOB;
$xsl = <<<EOB
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:php="http://php.net/xsl">
<xsl:output method="html" encoding="utf-8" indent="yes"/>
<xsl:template match="allusers">
  <html><body>
    <h2>Users</h2>
    <table>
     <xsl:for-each select="user">
      <tr><td>
        <xsl:value-of
            select="php:function('ucfirst',string(uid))"/>
       </td></tr>
     </xsl:for-each>
    </table>
   </body></html>
</xsl:template>
</xsl:stylesheet>
EOB;
$xmldoc = DOMDocument::loadXML($xml);
$xsldoc = DOMDocument::loadXML($xsl);

$proc = new XSLTProcessor();
$proc->registerPHPFunctions();
$proc->importStyleSheet($xsldoc);
echo
$proc->transformToXML($xmldoc);
?>

Historique

VersionDescription
5.1.0 Le paramètre restrict a été ajouté.


    Annonces       
 

 Retour au chapitre Php

 

Top
 

Ajouter JungleKey.fr à votre Explorateur

 
 

About Us | © 2007 JungleKey




iBlack | Mobile | Wiki | Ajouter ce moteur
.