<?xml version="1.0" encoding="UTF-8"?>

<!-- Génération du fichier index.htm à partir du fichier docbook index -->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
 <xsl:output method="html" encoding="utf-8"/>

 <xsl:template match="/">
  <html>
   <head>
    <title></title>
   </head>
    <style>
     a {text-decoration: underline; color: #c00000;}
     a:hover {text-decoration: none; color: #808080; font-style: italic;}
    </style>
   <body>
    <div align="center">
     <center>
      <table border="0" cellpadding="0" cellspacing="0" width="700" style="border-right: #cccccc 1px solid; border-top: #cccccc 1px solid; border-left: #cccccc 1px solid; border-bottom: #cccccc 1px solid">
       <tr>
        <td width="577">
         <img height="89" src="images/banNIJ.PNG" width="577" border="0"/>
        </td>
        <td width="123">
         <p align="center">
          <font face="Arial">
           <b>
            <font size="2" color="#003366">
             <xsl:variable name="m" select="substring(/article/articleinfo/date,6,2)"/>
             <xsl:choose>
              <xsl:when test="$m = '01'">January</xsl:when>
              <xsl:when test="$m = '02'">February</xsl:when>
              <xsl:when test="$m = '03'">March</xsl:when>
              <xsl:when test="$m = '04'">April</xsl:when>
              <xsl:when test="$m = '05'">May</xsl:when>
              <xsl:when test="$m = '06'">June</xsl:when>
              <xsl:when test="$m = '07'">July</xsl:when>
              <xsl:when test="$m = '08'">August</xsl:when>
              <xsl:when test="$m = '09'">September</xsl:when>
              <xsl:when test="$m = '10'">October</xsl:when>
              <xsl:when test="$m = '11'">November</xsl:when>
              <xsl:when test="$m = '12'">December</xsl:when>
             </xsl:choose>
            </font>&#160;
           </b>
           <br/>
           <font size="6" color="#003366"><strong><xsl:value-of select="substring(/article/articleinfo/date,1,4)"/></strong></font>
          </font>
         </p>
        </td>
       </tr>
       <tr>
        <td colspan="2" bgcolor="#c0c0c0">
         <p align="center">
          <font size="3">
           <font color="#003366">
            <br/>
            <b>
             <font size="5">
              <u><xsl:value-of select="/article/title"/></u>
              <br/>
             </font>
             <xsl:for-each select="/article/articleinfo/abstract/title | /article/articleinfo/abstract/para">
              <xsl:value-of select="text()"/>
              <xsl:if test="position() != last()">
               <br/>
              </xsl:if>
             </xsl:for-each>
            </b>
           </font>
          </font>
         </p>
         <xsl:if test="/article/warning/title">
         <p align="center" style="cursor:hand" target="1">
          <xsl:attribute name="onclick">window.open('<xsl:value-of select="translate(/article/warning/para/ulink/@url, '\', '/')"/>','MaFenetre','toolbars=no,location=no,status=no,barremenu=no,resizable=no,scrollbars=no,width=550,height=500,left=230, top=50');</xsl:attribute>
          <i>
           <font color="#000000">
            <xsl:value-of select="/article/warning/title"/>
            <br/>
            <br/>
           </font>
          </i>
          <font color="#cc0000">
           <xsl:value-of select="/article/warning/para/ulink"/>
          </font>
         </p>
         </xsl:if>
        </td>
       </tr>
       <tr>
        <td colspan="2">
         <font face="Arial">&#160;</font>
         <div align="center">
          <center>
           <table border="0" cellpadding="0" cellspacing="0" width="670" style="border-right: #c0c0c0 1px solid; border-top: #c0c0c0 1px solid; border-left: #c0c0c0 1px solid">
            <xsl:variable name="pondere">
             <xsl:apply-templates select="/article/section" mode="pondere"/>
            </xsl:variable>
            <xsl:variable name="coupe">
             <xsl:apply-templates select="msxsl:node-set($pondere)/section" mode="coupe"/>
            </xsl:variable>
            <xsl:variable name="colonnes" select="msxsl:node-set($coupe)"/>
            <xsl:for-each select="msxsl:node-set($coupe)/section/section">
             <xsl:if test="title != 's nom'">
              <tr>
               <td><xsl:value-of select="title"/></td>
              </tr>
             </xsl:if>
             <tr>
              <td width="350" valign="top" style="border-right: 1 solid #C0C0C0;">
               <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <xsl:apply-templates select="section[@col = 0]" mode="restit"/>
               </table><br/>
              </td>
              <td width="350" valign="top" style="border-right: 1 solid #C0C0C0;">
               <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <xsl:apply-templates select="section[@col = 1]" mode="restit"/>
               </table>
              </td>
             </tr>
            </xsl:for-each>
            <tr><td style="border-right: #c0c0c0 1px solid; border-left: #c0c0c0 1px solid; border-bottom: #c0c0c0 1px solid; text-align: center" colspan="2">
             <table border="0" cellpadding="0" cellspacing="0" width="84%" style="margin-top: 5px; border-right: #003366 1px solid; border-top: #003366 1px solid; border-left: #003366 1px solid; border-bottom: #003366 1px solid">
              <tr>
               <td width="100%" colspan="3" valign="top" align="middle" bgcolor="#003366">
                <p align="center">
                 <b>
                  <font face="Arial" color="#ffffff" size="3"><xsl:value-of select="/article/articleinfo/publisher/publishername"/></font>
                 </b>
                </p>
               </td>
              </tr>
              <tr>
               <td width="215" valign="top" align="middle">
                <font size="1" face="Arial">&#160;</font>
               </td>
               <td width="215" valign="top" align="middle">
                <font size="1" face="Arial">&#160;</font>
               </td>
               <td width="215" valign="top" align="middle">
                <font size="1" face="Arial">&#160;</font>
               </td>
              </tr>
              <tr>
               <td width="100%" colspan="3" valign="top" align="middle">
                <font size="1" face="Arial">
                 <p align="center">
                  <br/>
                  <xsl:value-of select="/article/articleinfo/corpauthor"/>
                 </p>
                 <p align="center">
                  <font size ="1">
                   <a><xsl:attribute name="href"><xsl:value-of select="/article/articleinfo/releaseinfo/ulink/@url"/></xsl:attribute><b><xsl:value-of select="/article/articleinfo/releaseinfo/ulink"/></b></a>
                   <br/>
                   <br/>
                  </font>
                 </p>
                </font>
               </td>
              </tr>
              <tr>
               <td colspan="2" background="images/fondbic.gif">
               </td>
              </tr>
             </table><br/>
             </td>
            </tr>
           </table>
          </center>
         </div><br/>
        </td>
       </tr>
      </table>
     </center>
    </div>
   </body>
  </html>
 </xsl:template>

 <xsl:template match="section" mode="restit">
  <xsl:variable name="prof" select="count(ancestor::section)"/>
  <xsl:choose>
   <xsl:when test="$prof = 2">
    <tr>
     <td width="100%">
      <xsl:if test="position() != 1">
       <br/>
      </xsl:if>
      <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-right: #c0c0c0 1px solid; border-left: #003366 1px solid;">
       <tr>
        <td bgcolor="#003366" width="6%">
         <font size="1">&#160;</font>
        </td>
        <td bgcolor="#c0c0c0" width="94%">
         <p style="font-family: Arial Black; font-size: 13; color: #003366;">
          <i>&#160;- <xsl:value-of select="title"/></i>
         </p>
        </td>
       </tr>
      </table>
     </td>
    </tr>
   </xsl:when>
   <xsl:when test="$prof = 3">
    <tr>
     <td width="100%">
      <p style="margin-left: 14px">
       <font size="2">
        <br/>
        <b>- <xsl:value-of select="title"/></b>
        <br/>
       </font>
      </p>
     </td>
    </tr>
   </xsl:when>
   <xsl:when test="$prof = 4">
    <tr>
     <td>
      <p style="margin-left: 20px; margin-right: 5px">
       <font size="1">
        ¤&#160;<xsl:value-of select="title"/>
       </font>
      </p>
     </td>
    </tr>
   </xsl:when>
  </xsl:choose>
  <tr>
   <td width="100%">
    <p style="margin-left: 20px; margin-right: 5px" >
     <font size="1" face="Arial">
      <xsl:apply-templates select="itemizedlist/listitem/para/ulink" mode="restit"/>
     </font>
    </p>
   </td>
  </tr>
  <xsl:apply-templates select="section" mode="restit"/>
 </xsl:template>

 <xsl:template match="ulink" mode="restit">
  <img height="5" src="images/bt-cr22.png" width="5" border="0"/>
  <a href="javascript:void(0)"><xsl:attribute name="onClick">window.open('<xsl:value-of select="translate(@url, '\', '/')"/>','MaFenetre','toolbars=yes,location=yes,status=yes,resizable=yes,scrollbars=yes,width=550,height=500,left=200, top=50');</xsl:attribute><xsl:value-of select="text()"/></a>
  <br/>
 </xsl:template>
 
 <xsl:template match="@* | node()" mode="restit"/>

 <xsl:template match="section" mode="pondere">
  <xsl:copy>
   <xsl:if test="count(ancestor::section) = 2">
    <xsl:attribute name="poids"><xsl:value-of select="count(descendant::section)+count(descendant::ulink)"/></xsl:attribute>
   </xsl:if>
   <xsl:apply-templates select="@* | node()" mode="pondere"/>
  </xsl:copy>
 </xsl:template>

 <xsl:template match="@* | node()" mode="pondere">
  <xsl:copy>
   <xsl:apply-templates select="@* | node()" mode="pondere"/>
  </xsl:copy>
 </xsl:template>

 <xsl:template match="section" mode="coupe">
  <xsl:copy>
   <xsl:if test="count(ancestor::section) = 2">
    <xsl:attribute name="col">
     <xsl:variable name="gauche" select="sum(preceding-sibling::section/@poids)"/>
     <xsl:variable name="droite" select="sum(following-sibling::section/@poids)"/>
     <xsl:variable name="agauche">
      <xsl:choose>
       <xsl:when test="(@poids + $gauche) &gt; $droite">
        <xsl:value-of select="@poids + $gauche - $droite"/>
       </xsl:when>
       <xsl:otherwise>
        <xsl:value-of select="$droite - (@poids + $gauche)"/>
       </xsl:otherwise>
      </xsl:choose>
     </xsl:variable>
     <xsl:variable name="adroite">
      <xsl:choose>
       <xsl:when test="(@poids + $droite) &gt; $gauche">
        <xsl:value-of select="@poids + $droite - $gauche"/>
       </xsl:when>
       <xsl:otherwise>
        <xsl:value-of select="$gauche - (@poids + $droite)"/>
       </xsl:otherwise>
      </xsl:choose>
     </xsl:variable>
     <xsl:choose>
      <xsl:when test="$agauche &lt; $adroite">0</xsl:when>
      <xsl:otherwise>1</xsl:otherwise>
     </xsl:choose>
    </xsl:attribute>
   </xsl:if>
   <xsl:apply-templates select="@* | node()" mode="coupe"/>
  </xsl:copy>
 </xsl:template>

 <xsl:template match="@* | node()" mode="coupe">
  <xsl:copy>
   <xsl:apply-templates select="@* | node()" mode="coupe"/>
  </xsl:copy>
 </xsl:template>

</xsl:stylesheet>
