<html>
<head>


<title>&lt;xsl:comment&gt;</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Description">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">&lt;xsl:comment&gt;</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">
Permet de cr&eacute;er un commentaire dans le document de sortie. Les commentaires sont parfois utilis&eacute;s pour ajouter des annonces l&eacute;gales, des avis de non-responsabilit&eacute; ou des informations relatives &agrave; la date de cr&eacute;ation du document de sortie. Une autre application pertinente de l'&eacute;l&eacute;ment <span class="LITERAL">&lt;xsl:comment&gt;</span> consiste &agrave; g&eacute;n&eacute;rer des d&eacute;finitions CSS ou un code JavaScript dans un document HTML.</td></tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Cat&eacute;gorie</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>Instruction</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Attributs obligatoires</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>Aucun.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Attributs facultatifs</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>Aucun.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Contenu</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>Un mod&egrave;le XSLT.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Appara&icirc;t dans</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>
<span class="LITERAL">&lt;xsl:comment&gt;</span> appara&icirc;t dans un mod&egrave;le.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">D&eacute;fini dans</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>XSLT section 7.4, Cr&eacute;ation de commentaires. </p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Exemple</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>La feuille de style suivante g&eacute;n&egrave;re un commentaire permettant de d&eacute;finir des styles CSS dans un document HTML&nbsp;:</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;

  &lt;xsl:output method=&quot;html&quot;/&gt;

  &lt;xsl:template match=&quot;/&quot;&gt;
    &lt;html&gt;
      &lt;head&gt;
        &lt;title&gt;XSLT and CSS Demo&lt;/title&gt;
        &lt;style&gt;
          &lt;xsl:comment&gt;
            p.big      {font-size: 125%; font-weight: bold} 
            p.green    {color: green; font-weight: bold} 
            p.red      {color: red; font-style: italic}
          &lt;/xsl:comment&gt;
        &lt;/style&gt;
      &lt;/head&gt;
      &lt;body&gt;
        &lt;xsl:apply-templates select=&quot;list/title&quot;/&gt;
        &lt;xsl:apply-templates select=&quot;list/listitem&quot;/&gt;
      &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match=&quot;title&quot;&gt;
    &lt;p class=&quot;big&quot;&gt;&lt;xsl:value-of select=&quot;.&quot;/&gt;&lt;/p&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match=&quot;listitem&quot;&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test=&quot;position() mod 2&quot;&gt;
        &lt;p class=&quot;green&quot;&gt;&lt;xsl:value-of select=&quot;.&quot;/&gt;&lt;/p&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;p class=&quot;red&quot;&gt;&lt;xsl:value-of select=&quot;.&quot;/&gt;&lt;/p&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;
  
&lt;/xsl:stylesheet&gt;</pre></span>
<p>Cette feuille de style cr&eacute;e les trois styles CSS figurant dans un commentaire HTML.  Cette feuille de style est appliqu&eacute;e au document suivant&nbsp;:</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;list xml:lang=&quot;en&quot;&gt;
  &lt;title&gt;Albums I've bought recently:&lt;/title&gt;
  &lt;listitem&gt;The Sacred Art of Dub&lt;/listitem&gt;
  &lt;listitem&gt;Only the Poor Man Feel It&lt;/listitem&gt;
  &lt;listitem&gt;Excitable Boy&lt;/listitem&gt;
  &lt;listitem xml:lang=&quot;sw&quot;&gt;Aki Special&lt;/listitem&gt;
  &lt;listitem xml:lang=&quot;en-gb&quot;&gt;Combat Rock&lt;/listitem&gt;
  &lt;listitem xml:lang=&quot;zu&quot;&gt;Talking Timbuktu&lt;/listitem&gt;
  &lt;listitem xml:lang=&quot;jz&quot;&gt;The Birth of the Cool&lt;/listitem&gt;
&lt;/list&gt;</pre></span> <!--<?troff .Nd 10?>-->
<p>La feuille de style applique un style CSS &agrave; l'&eacute;l&eacute;ment <span class="LITERAL">&lt;title&gt;</span>, puis alternera entre les deux autres styles CSS pour les &eacute;l&eacute;ments <span class="LITERAL">&lt;listitem&gt;</span>. Le document HTML g&eacute;n&eacute;r&eacute; est le suivant&nbsp;:</p>
<span class="PROGRAMLISTING"><pre>
&lt;html&gt;
&lt;head&gt;
&lt;META http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
&lt;title&gt;XSLT and CSS Demo&lt;/title&gt;
&lt;style&gt;
&lt;!-- 
            p.big      {font-size: 125%; font-weight: bold} 
            p.green    {color: green; font-weight: bold} 
            p.red      {color: red; font-style: italic}
          --&gt;
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p class=&quot;big&quot;&gt;Albums I've bought recently:&lt;/p&gt;
&lt;p class=&quot;green&quot;&gt;The Sacred Art of Dub&lt;/p&gt;
&lt;p class=&quot;red&quot;&gt;Only the Poor Man Feel It&lt;/p&gt;
&lt;p class=&quot;green&quot;&gt;Excitable Boy&lt;/p&gt;
&lt;p class=&quot;red&quot;&gt;Aki Special&lt;/p&gt;
&lt;p class=&quot;green&quot;&gt;Combat Rock&lt;/p&gt;
&lt;p class=&quot;red&quot;&gt;Talking Timbuktu&lt;/p&gt;
&lt;p class=&quot;green&quot;&gt;The Birth of the Cool&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></span>
<p>Une fois affich&eacute;, le document ressemble &agrave; la<link linkend="xslt-appa-a6">Figure A-6</link>.</p>
<figure label="A-6" id="xslt-appa-a6">
        <p class="TITLE">Document ayant g&eacute;n&eacute;r&eacute; des n&oelig;uds de commentaire</p>
        <graphic depth="323" width="405" fileref="figs/xslt.aa06.gif"/></figure>
</td>
</tr>
</table>
</div>
</body>
</html>
