<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://www.llaumgui.com/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Le blog de llaumgui - Balise - XSL</title>
  <link>http://www.llaumgui.com/</link>
  <atom:link href="http://www.llaumgui.com/feed/tag/XSL/rss2" rel="self" type="application/rss+xml"/>
  <description>Linux en général, Fedora en particulier...</description>
  <language>fr</language>
  <pubDate>Wed, 03 Dec 2008 15:54:44 +0100</pubDate>
  <copyright>http://creativecommons.org/licenses/by-nc-nd/2.5/</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Aventure XML - Part4 (Problème de balise)</title>
    <link>http://www.llaumgui.com/post/aventure-xml-4-probleme-de-balise</link>
    <guid isPermaLink="false">urn:md5:bac680bcde4f34fdc8297089a155d69f</guid>
    <pubDate>Tue, 01 Feb 2005 19:36:00 +0000</pubDate>
    <dc:creator>llaumgui</dc:creator>
        <category>Développement web</category>
        <category>php</category><category>XML</category><category>XSL</category>    
    <description>&lt;p&gt;L'XML/XSL est un langage à balise tout comme l'HTML, mais là où l'HTML s'arrête à du texte pur, l'XSL permet de faire des boucles, des tests, etc... Arrêtons nous justement sur ces tests et plus particulièrement les tests de supériorité et d'infériorité...&lt;/p&gt;    &lt;p&gt;Dans la plupart des langages, nous avons :&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;2 &amp;gt; 1&lt;br /&gt;
1 &amp;lt; 2&lt;/p&gt;
&lt;p&gt;Mais le problème de l'XSL est que les signes &amp;lt; et &amp;gt; sont déjà utilisés par les balises... Ainsi on peut faire des tests avec &amp;gt; mais pas avec &amp;lt;&lt;br /&gt;
Ainsi on ce retrouve donc dans la situation absurde de pouvoir faire des tests de supériorité mais pas d'infériorité... L'astuce revient alors à faire des tests de &lt;strong&gt;non supériorité&lt;/strong&gt; &lt;img src=&quot;/themes/default/smilies/smile.png&quot; alt=&quot;:-)&quot; class=&quot;smiley&quot; /&gt; .&lt;/p&gt;
&lt;p&gt;Un petit exemple du parcours d'un fichier XML :&lt;/p&gt;
&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;
&lt;span style=&quot;color: rgb(0, 119, 0);&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot;&gt;xsl&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot;&gt;:for-&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot;&gt;each select&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot;&gt;&amp;quot;image [(position() &amp;gt;= $img_begin) and not (position() &amp;gt; $img_end)]&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot;&gt;&amp;gt;
&lt;br /&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;
&lt;p&gt;Alors que la logique voudrait :&lt;/p&gt;
&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;
&lt;span style=&quot;color: rgb(0, 119, 0);&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot;&gt;xsl&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot;&gt;:for-&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot;&gt;each select&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot;&gt;&amp;quot;image [(position() &amp;gt;= $img_begin) and (position() &amp;lt; $img_end)]&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot;&gt;&amp;gt;
&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;
&lt;fieldset class=&quot;links&quot;&gt;&lt;legend&gt;Poursuivre l'aventure : &lt;/legend&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-1-choix-dun-processeur-xslt-et-couche-dabstraction&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part1 (Choix d'un processeur XSLT et couche d'abstraction)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-2-drivers-domxml&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part2 (Drivers DomXML)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-3-drivers-xsltproc&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part3 (Drivers xsltProc)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Aventure XML - Part4 (Problème de balise).&lt;/li&gt;
&lt;/ul&gt;
&lt;/fieldset&gt;</description>
    
    
    
          <comments>http://www.llaumgui.com/post/aventure-xml-4-probleme-de-balise#comment-form</comments>
      <wfw:comment>http://www.llaumgui.com/post/aventure-xml-4-probleme-de-balise#comment-form</wfw:comment>
      <wfw:commentRss>http://www.llaumgui.com/feed/atom/comments/15</wfw:commentRss>
      </item>
    
  <item>
    <title>Aventure XML - Part3 (Drivers xsltProc)</title>
    <link>http://www.llaumgui.com/post/aventure-xml-3-drivers-xsltproc</link>
    <guid isPermaLink="false">urn:md5:efd58eb0d8667881d4428d47691c77e4</guid>
    <pubDate>Tue, 01 Feb 2005 01:44:00 +0000</pubDate>
    <dc:creator>llaumgui</dc:creator>
        <category>Développement web</category>
        <category>php</category><category>XML</category><category>XSL</category><category>XSLT</category>    
    <description>&lt;p&gt;Nous avons vu précédemment les concepts d'&lt;a href=&quot;http://www.llaumgui.com/post/php-base-de-donnees-et-couche-d39abstraction-1-principe&quot; hreflang=&quot;fr&quot;&gt;abstraction de SGBD&lt;/a&gt;, d'&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-1-choix-dun-processeur-xslt-et-couche-dabstraction&quot; hreflang=&quot;fr&quot;&gt;abstraction de processeur XSLT&lt;/a&gt; et je vous ai livré le code de &lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-2-drivers-domxml&quot; hreflang=&quot;fr&quot;&gt;mes drivers pour processeur domXML&lt;/a&gt;... Ce coup si c'est le code de mes drivers xsltProc que je vous livre.&lt;/p&gt;    &lt;p&gt;Comme vous pouvez le voir dans les commentaires du code, ces drivers m'ont donné plus de mal que les autres, mais l'abstraction marche nickel et je passe allégrement de l'un à l'autre avec la même syntaxe (D'un autre côté c'est un peu le but :-)).&lt;/p&gt;


&lt;p&gt;Si mon fichier XML était plus gros je pourrais même benchmarker et faire des tests domXML vs xsltProc...&lt;/p&gt;


&lt;p&gt;&lt;em&gt;Pour pouvoir utiliser xsltProc, vous devez avoir accès à &lt;strong&gt;/usr/bin/xsltproc&lt;/strong&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/*---------------------------------------------------&lt;br /&gt;
* PhotoLib 1.0&lt;br /&gt;
* PhotoLib, la Galerie web.&lt;br /&gt;
* --------------------------------------------------&lt;br /&gt;
* Par Guillaume Kulakowski&lt;br /&gt;
* Développée pour la Licence Professionnelle.&lt;br /&gt;
* --------------------------------------------------*/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
* couche d'abstraction gérant la gestion du processeur XSLT xsltProc.&lt;br /&gt;
* @package PhotoLib&lt;br /&gt;
* @version $Id&lt;br /&gt;
*/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; xsltProcessor &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/*&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* Variable de la classe.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$XML_file&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Document XML&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$XSL_file&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Document XSL&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$html&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$cpt&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Compteur de transformation&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* Constructeur de la classe xsltProcessor. C'est le constructeur qui va&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* récupérer et charger les documents XML et XSL.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param (String) Document XML.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param (String) Document XSL.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param (String) Chemin vers xsltProc (Facultatif, par défaut :&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* /usr/bin/xsltproc).&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; xsltProcessor&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$XML_file&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$XSL_file&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$xsltProcPath&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;'/usr/bin/xsltproc'&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;XML_file&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$XML_file&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;XSL_file&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$XSL_file&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;xsltProcPath&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style=&quot;color: #0000ff;&quot;&gt;$xsltProcPath&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;cpt&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Initialisation du compteur.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* Gère la transformation du document XML.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param (array) Paramètre à passer au document XSL. Ce dernier peut être&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* null.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; transform&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$param&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$paramString&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Paramètres sous la forme d'un String.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Transformation avec passage de paramètres :&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$param&lt;/span&gt; != &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// On mets les paramètres sous la bonne forme (--param key 'value')&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$param&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$key&lt;/span&gt; =&amp;gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$value&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$paramString&lt;/span&gt; .= &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;--param $key &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&amp;quot;&lt;/span&gt;'$value'&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&amp;quot;&lt;/span&gt; &amp;quot;&lt;/span&gt;; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// La syntaxe xsltProc est un peu plus agressive :).&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$xslt&lt;/span&gt; &amp;nbsp; &amp;nbsp; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;xsltProcPath&lt;/span&gt;.&lt;span style=&quot;color: #0000ff;&quot;&gt;$paramString&lt;/span&gt;.&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;XSL_file&lt;/span&gt;.&lt;span style=&quot;color: #ff0000;&quot;&gt;' '&lt;/span&gt;.&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;XML_file&lt;/span&gt;.&lt;span style=&quot;color: #ff0000;&quot;&gt;' 2&amp;gt;&amp;amp;amp;1'&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://www.php.net/exec&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;exec&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$xslt&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;cpt&lt;/span&gt;++;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* A partir d'un domDocument généré par transform(), retourne le code html&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* de ce domDocument.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @return (String) Code html.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; output&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$output&lt;/span&gt; = &lt;a href=&quot;http://www.php.net/implode&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;implode&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/*&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* Alors là on nage dans le paranormal digne de X-Files... Il est 2H du mat' et&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* je me rend compte que la remis à 0 de $html est indispensable...&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* Elle influe sur le dernier index de $param et uniquement pour action = content...&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* A n'y rien comprendre...&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;html&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$output&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* Compte le nombre de transformation XSLT effectuées.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @return (int) Nombre de transformation XSLT&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; xsltCount&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;cpt&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* Compte le nom du processeur XSLT.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @return (String) Nom du processeur XSLT.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; xsltName&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'xsltProc'&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Fin.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;

&lt;fieldset class=&quot;links&quot;&gt;&lt;legend&gt;Poursuivre l'aventure : &lt;/legend&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-1-choix-dun-processeur-xslt-et-couche-dabstraction&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part1 (Choix d'un processeur XSLT et couche d'abstraction)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-2-drivers-domxml&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part2 (Drivers DomXML)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Aventure XML - Part3 (Drivers xsltProc).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-4-probleme-de-balise&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part4 (Problème de balise)&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/fieldset&gt;</description>
    
    
    
          <comments>http://www.llaumgui.com/post/aventure-xml-3-drivers-xsltproc#comment-form</comments>
      <wfw:comment>http://www.llaumgui.com/post/aventure-xml-3-drivers-xsltproc#comment-form</wfw:comment>
      <wfw:commentRss>http://www.llaumgui.com/feed/atom/comments/14</wfw:commentRss>
      </item>
    
  <item>
    <title>Aventure XML - Part2 (Drivers DomXML)</title>
    <link>http://www.llaumgui.com/post/aventure-xml-2-drivers-domxml</link>
    <guid isPermaLink="false">urn:md5:0850d828b67016ee4c63471541ec4dc3</guid>
    <pubDate>Mon, 31 Jan 2005 17:18:00 +0000</pubDate>
    <dc:creator>llaumgui</dc:creator>
        <category>Développement web</category>
        <category>php</category><category>XML</category><category>XSL</category><category>XSLT</category>    
    <description>&lt;p&gt;Après avoir testé pas mal de processeur XSLT, mon choix c'est arrêté sur &lt;a href=&quot;http://php.net/domxml&quot; hreflang=&quot;fr&quot; title=&quot;DomXML&quot;&gt;DomXML&lt;/a&gt; qui malgré son stade toujours expérimental, n'en demeure pas moi très bon et surtout très répandu (Le principal critère de sélection en fait).&lt;/p&gt;    &lt;p&gt;Mise en garde issue de php.net :&lt;/p&gt;


&lt;blockquote&gt;&lt;p&gt;Ce module est EXPERIMENTAL. Cela signifie que le comportement de ces fonctions, leurs noms et concrètement, TOUT ce qui est documenté ici peut changer dans un futur proche, SANS PREAVIS! Soyez-en conscient, et utilisez ce module à vos risques et périls.&lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-1-choix-dun-processeur-xslt-et-couche-dabstraction&quot; hreflang=&quot;fr&quot;&gt;Précédemment&lt;/a&gt; nous avions évoqué le principe de l'abstraction du processeur XSLT, je vous livre donc le code de mon driver pour DomXML.&lt;/p&gt;

&lt;code class=&quot;php&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/*---------------------------------------------------&lt;br /&gt;
* PhotoLib 1.0&lt;br /&gt;
* PhotoLib, la Galerie web.&lt;br /&gt;
* --------------------------------------------------&lt;br /&gt;
* Par Guillaume Kulakowski&lt;br /&gt;
* Développée pour la Licence Professionnelle.&lt;br /&gt;
* --------------------------------------------------*/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
* couche d'abstraction gérant la gestion du processeur XSLT Domxml.&lt;br /&gt;
* @package PhotoLib&lt;br /&gt;
* @version $Id&lt;br /&gt;
*/&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; xsltProcessor &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/*&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* Variables de la classe.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$xml&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// dom.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$xsl&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// domxsltStylesheet.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$html&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// domDocument.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$cpt&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Compteur de transformation.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* Constructeur de la classe xsltProcessor. C'est le constructeur qui va&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* récupérer et charger les documents XML et XSL.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param (String) Document XML.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param (String) Document XSL.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; xsltProcessor&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$XML_file&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$XSL_file&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;xslt&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = domxml_xslt_stylesheet_file&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$XSL_file&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Chargement de la feuille XSL.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;xml&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = domxml_open_file&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$XML_file&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Chargement de la feuille XML.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;cpt&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Compteur de transformation à 0.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* Gère la transformation du document XML.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @param (array) Paramètre à passer au document XSL. Ce dernier peut être&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* null.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; transform&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$param&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Transformation avec passage de paramètre :&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$param&lt;/span&gt; != &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;html&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;xslt&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;process&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;xml&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$param&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Transformation sans paramètre :&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;html&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;xslt&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;process&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;xml&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;cpt&lt;/span&gt;++;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* A partir d'un domDocument généré par transform(), retourne le code html&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* de ce domDocument.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @return (String) Code html.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; output&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;html&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;html_dump_mem&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* Compte le nombre de transformation XSLT effectuées.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @return (int) Nombre de transformation XSLT&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; xsltCount&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;cpt&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;/**&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* Compte le nom du processeur XSLT.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;* @return (String) Nom du processeur XSLT.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; xsltName&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'&amp;lt;a href=&amp;quot;http://php.net/domxml&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;DomXML&amp;lt;/a&amp;gt;'&lt;/span&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Fin.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;

&lt;fieldset class=&quot;links&quot;&gt;&lt;legend&gt;Poursuivre l'aventure : &lt;/legend&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-1-choix-dun-processeur-xslt-et-couche-dabstraction&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part1 (Choix d'un processeur XSLT et couche d'abstraction)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Aventure XML - Part2 (Drivers DomXML).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-3-drivers-xsltproc&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part3 (Drivers xsltProc)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-4-probleme-de-balise&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part4 (Problème de balise)&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/fieldset&gt;</description>
    
    
    
          <comments>http://www.llaumgui.com/post/aventure-xml-2-drivers-domxml#comment-form</comments>
      <wfw:comment>http://www.llaumgui.com/post/aventure-xml-2-drivers-domxml#comment-form</wfw:comment>
      <wfw:commentRss>http://www.llaumgui.com/feed/atom/comments/11</wfw:commentRss>
      </item>
    
  <item>
    <title>Aventure XML - Part1 (Choix d'un processeur XSLT et couche d'abstraction)</title>
    <link>http://www.llaumgui.com/post/aventure-xml-1-choix-dun-processeur-xslt-et-couche-dabstraction</link>
    <guid isPermaLink="false">urn:md5:08231cd7988bf5b1da8f58373372ee24</guid>
    <pubDate>Mon, 31 Jan 2005 02:20:00 +0000</pubDate>
    <dc:creator>llaumgui</dc:creator>
        <category>Développement web</category>
        <category>php</category><category>XML</category><category>XSL</category><category>XSLT</category>    
    <description>&lt;p&gt;Je travail actuellement sur un projet mêlant XML/XSL et php.
Afin de contrôler l'affichage des données XML selon la feuille de style XSL, j'ai décidé d'effectuer cette transformation côté serveur.
Et là c'est le début de la galère.&lt;/p&gt;    &lt;p&gt;Pour ceux qui ne comprennent pas comment marche le XML/XSL via php, voici un petit schéma :&lt;/p&gt;
&lt;p class=&quot;center&quot;&gt;&lt;img src=&quot;http://www.llaumgui.com/public/images/web/schema_php_xslt.gif&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Cependant la chose est plus complexe... En effet, il n'existe pas un mais plusieurs processeurs XSLT pouvant effectuer la transformation XML/XSL en HTML. Pire que ça, ils ne sont pas compatibles à la fois php4 et php5... Et bien sûr ils possèdent chacun leurs qualités et leur défauts...&lt;/p&gt;
&lt;p&gt;Nous nous retrouvons donc avec une configuration que nous connaissons bien (&lt;a href=&quot;http://www.llaumgui.com/post/php-base-de-donnees-et-couche-d39abstraction-1-principe&quot;&gt;Rappelez-vous&lt;/a&gt;)... Un seul code php mais le besoin de gérer plusieurs systèmes avec... En effet, ce qui marche avec des systèmes de base de données (SGBD) marche aussi avec des processeur XSLT :&lt;/p&gt;
&lt;p class=&quot;center&quot;&gt;&lt;img src=&quot;http://www.llaumgui.com/public/images/web/abstraction_php_xslt.gif&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Les couches d'abstraction sont donc l'avenir du developpement...&lt;/p&gt;
&lt;p&gt;Poussons la comparaison entre XML et SGBD encore plus loin et confrontons l'XML à la base de données la plus utilisée dans le développement web, j'ai nommé : &lt;a href=&quot;http://www.mysql.com&quot; hreflang=&quot;us&quot;&gt;MySQL&lt;/a&gt;.&lt;br /&gt;
Le temps de génération de page en effectuant une ou plusieurs transformations XSLT (Toujours issues des mêmes feuilles XML et XSL) est tout simplement bluffant !&lt;/p&gt;
&lt;pre&gt;Page générée en 3 transformations XSLT (XML/XSL) en 0.00853s via DomXML.&lt;/pre&gt;
&lt;p&gt;Le couple XML/XSL semble plus approprié, selon moi,qu'un SGBD pour une petite quantité de données stockées...&lt;/p&gt;
&lt;fieldset class=&quot;links&quot;&gt;&lt;legend&gt;Quelques liens utiles&lt;/legend&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.laltruiste.com/document.php?url=http://www.laltruiste.com/coursxsl/sommaire.html&quot; hreflang=&quot;fr&quot;&gt;L'altruiste&lt;/a&gt; (Les bases et plus du XSL).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.atelierphp5.com/&quot; hreflang=&quot;fr&quot;&gt;Atelier php5&lt;/a&gt; (Blog de Dash qui à lui aussi exploré l'XML/XSL)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.neokraft.net/&quot; hreflang=&quot;fr&quot;&gt;Neokraft&lt;/a&gt;
(Blog du concepteur de dotCleat).&lt;/li&gt;
&lt;/ul&gt;
&lt;/fieldset&gt;
&lt;fieldset class=&quot;links&quot;&gt;&lt;legend&gt;Poursuivre l'aventure : &lt;/legend&gt;&lt;ul&gt;
&lt;li&gt;Aventure XML - Part1 (Choix d'un processeur XSLT et couche d'abstraction).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-2-drivers-domxml&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part2 (Drivers DomXML)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-3-drivers-xsltproc&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part3 (Drivers xsltProc)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.llaumgui.com/post/aventure-xml-4-probleme-de-balise&quot; hreflang=&quot;fr&quot;&gt;Aventure XML - Part4 (Problème de balise)&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/fieldset&gt;</description>
    
    
    
          <comments>http://www.llaumgui.com/post/aventure-xml-1-choix-dun-processeur-xslt-et-couche-dabstraction#comment-form</comments>
      <wfw:comment>http://www.llaumgui.com/post/aventure-xml-1-choix-dun-processeur-xslt-et-couche-dabstraction#comment-form</wfw:comment>
      <wfw:commentRss>http://www.llaumgui.com/feed/atom/comments/10</wfw:commentRss>
      </item>
    
</channel>
</rss>