Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1642 connectés 

  FORUM HardWare.fr
  Programmation
  XML/XSL

  for-each imbriqués[resolu]

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

for-each imbriqués[resolu]

n°1455860
OyT
dyslexics have more fnu
Posté le 12-10-2006 à 10:40:38  profilanswer
 

Salut à tous, je débute en xsl/xml et j'aurais une petite question qui sera peut-être idiote mais bon tampis:
 
voila j'ai deux boucles for-each imbriquées et je ne sais pas comment récupérer les données de la première à l'intérieur de la seconde:
 
j'ai:
 
<xsl:for-each select="$livre">
 
        <xsl:for-each select="$auteur">
                              <!-- Comment récupérer le titre du livre ici? -->
        </xsl:for-each>
 
</xsl:for-each>
 
Dans une boucle simple j'y arrve, j'arrive par exemple à récupérer le nom de l'auteur. avec <xsl:value-of select="nom"/> mais comment faire pour le titre du livre?
 
Le titre du livre n'est qu'un exemple, j'ai besoin de ça dans d'autre cas. mais j'ai pris le plus simple.
Merci d'avance.


Message édité par OyT le 12-10-2006 à 11:15:52
mood
Publicité
Posté le 12-10-2006 à 10:40:38  profilanswer
 

n°1455868
MagicBuzz
Posté le 12-10-2006 à 10:46:02  profilanswer
 

Le seum moyen que j'ai trouvé, c'est de copier le noeud courant du premier "for-each" dans une variable (avec node-copy)
 
Puis de la rappeler dans ma boucle imbriquée à l'aide d'un "msxsl:node-set()" (fonction proprio Microsoft, son équivalent existe dans la plupart des parseurs XSL 1 sous cette forme (mais autre préfixe) puisque la version XSL 2.0 comprend cette fonction)
 
-- Edit
 
Si t'as besoin juste d'une donnée (et non de tout le noeud) alors tu peux utiliser une simple variable toute bête évidement...


Message édité par MagicBuzz le 12-10-2006 à 10:46:59
n°1455876
OyT
dyslexics have more fnu
Posté le 12-10-2006 à 10:53:20  profilanswer
 

le problème avec une variable toute simple c'est qu'on ne peut pas la modifier. au début c'est ce que j'avais pensé faire mais ça ne marche pas.
 
je vais me renseigner sur comment utiliser les "nodes" Merci. :jap:

n°1455884
MagicBuzz
Posté le 12-10-2006 à 11:06:06  profilanswer
 

pkoi tu veux modifier ta variable ?
 


<xsl:for-each select="livre">
  <xsl:variable name="titre"><xsl:value-of select="titre"/></xsl:variable>
  <xsl:for-each select="Auteur">
    Auteur : <xsl:value-of select="nom"/> - <xsl:value-of select="$titre"/><br/>
  </xsl:for-each>
</xsl:for-each>


=> Ca doit faire ce que tu veux normalement...

n°1455887
OyT
dyslexics have more fnu
Posté le 12-10-2006 à 11:10:24  profilanswer
 

ah oui....  :pt1cable: désolé. mais je pensé pas qu'en la déclarant à l'intérieur ça fonctionnait comme une variable locale... oui effectivement comme ça ça  marche. j'ai que 2 3 variable donc je pense que je faire ça. merci beaucoup.
 
Comment galérer des heures pour un petit rien.... :heink:

n°1455922
MagicBuzz
Posté le 12-10-2006 à 11:48:56  profilanswer
 

faut dire que le XSL, c'est un peu tellement limité qu'on butte même sur les trucs simple en se disant que ça peut pas marcher :D

n°1456147
avander
Posté le 12-10-2006 à 15:41:28  profilanswer
 

le for-each c'est mal... :non:

n°1456404
rx__
Paint It Black
Posté le 12-10-2006 à 21:32:41  profilanswer
 

MagicBuzz a écrit :

faut dire que le XSL, c'est un peu tellement limité qu'on butte même sur les trucs simple en se disant que ça peut pas marcher :D


XSL est Turing-complete, donc d'un point de vue théorique on peut tout faire. Partant de là, il ne reste plus qu'à trouver comment... et ça peut parfois être trèèèès compliqué.  ;)

n°1456503
MagicBuzz
Posté le 13-10-2006 à 09:40:42  profilanswer
 

avander a écrit :

le for-each c'est mal... :non:


tu veux faire quoi à la place ?
des apply-template ?
et tu gères comment les notions d'imbrication justement ? parceque là pour le coup, tu ne peux pas utiliser de variable...
 
-- quoique nan j'ai rien dit, c'est vrai qu'on peut passer des paramètres à un applytemplate

Message cité 1 fois
Message édité par MagicBuzz le 13-10-2006 à 09:41:53
n°1456545
avander
Posté le 13-10-2006 à 10:46:21  profilanswer
 

MagicBuzz a écrit :

tu veux faire quoi à la place ?
des apply-template ?
et tu gères comment les notions d'imbrication justement ? parceque là pour le coup, tu ne peux pas utiliser de variable...
 
-- quoique nan j'ai rien dit, c'est vrai qu'on peut passer des paramètres à un applytemplate


 
Ben voila! Non sans déconner, le for-each est souvent utilisé de façon abusive, par 'paresse' ou par 'facilité alors que le méchanisme à la base des transformations est justement là pour faciliter le travail.
 
Fais le test, un stylesheet avec juste un template pour le root avec un apply-templates dedans, en sortie tu retrouve toutes les données de ton xml sans avoir rien fait!  
 
Ce qui veut dire que le moteur fait un travail considérable et l'idée c'est d'exploiter ce travail facilement.
Un template générique pour filtrer tout ce qui nous intéresse pas, un template pour livre et un pour auteur et en avant!
 
Beacoup vont argumenter en disant: mais c'est pas performant! Dans la pratique on s'en tape un peu que l'ordi mouline peu ou pas, du moment que le travail est fait.
 
Un article intéressant concernant l'approche push et pull pour résoudre un problème en XSL-T http://www.xml.com/pub/a/2005/07/06/tr.html


Message édité par avander le 13-10-2006 à 10:50:01
mood
Publicité
Posté le 13-10-2006 à 10:46:21  profilanswer
 

n°1456771
MagicBuzz
Posté le 13-10-2006 à 14:00:14  profilanswer
 

en fait, j'utilise le template comme "template" justement.
 
et pour les sous-traîtements à l'intérieur d'un bloc, c'est vrai que je ne m'en sert que rarement (peut-être à tord) car je trouve que sémantiquement, je n'utilise pas un sous-bloc.
 
en tout cas, c'est sûr qu'il y a certainement moyen de faire mieux que mes usines à gaz ;)
 


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
  <xsl:import href="include/variables.xsl"/>
  <xsl:import href="include/copyright.xsl"/>
  <xsl:import href="include/login.xsl"/>
  <xsl:import href="include/head.xsl"/>
  <xsl:import href="include/menu.xsl"/>
  <xsl:import href="include/banner.xsl"/>
  <xsl:template match="/" xmlns="http://www.w3.org/1999/xhtml">
    <html>
      <xsl:call-template name="head"/>
      <body>
        <center>
          <form action="/?page=P_HOME" method="post" onsubmit="submitForm();">
            <input type="hidden" name="chp:wk" id="chp:wk"/>
            <input type="hidden" name="chp:emp" id="chp:emp"/>
            <xsl:call-template name="banner"/>
            <div id="top">
              <h1>
                <xsl:value-of select="page/title"/>
              </h1>
              <xsl:call-template name="login"/>
            </div>
            <xsl:call-template name="menu"/>
            <div id="content">
              <xsl:value-of select="void"/>
              <xsl:apply-templates select="/page/login/line/calendrier"/>
            </div>
            <xsl:call-template name="copyright"/>
          </form>
        </center>
      </body>
    </html>
  </xsl:template>
  <xsl:template match="calendrier" xmlns="http://www.w3.org/1999/xhtml">
    <xsl:choose>
      <xsl:when test="/page/login/line/rights = 1">
        <fieldset>
          <legend>Choisissez un mois :</legend>
         <input type="hidden" id="hAnnee" value="{/page/parameters/parameter[@name = 'chp:annee']/@value}"/>
         <input type="hidden" id="hMois" value="{/page/parameters/parameter[@name = 'chp:mois']/@value}"/>
          Année <select name="chp:annee" id="fAnnee"><xsl:value-of select="void"/></select> Mois <select name="chp:mois" id="fMois"><xsl:value-of select="void"/></select>
          <div id="navPlaceHolder"><xsl:value-of select="void"/></div>
        </fieldset>
        <br/>
        <br/>
        <table border="1" style="empty-cells: show;">
          <tr>
            <th colspan="2"><xsl:value-of select="line/nm"/>&#160;<xsl:value-of select="line/yyyy"/></th>
            <xsl:for-each select="../employe/line">
              <th>
                <xsl:value-of select="nom"/>
              </th>
            </xsl:for-each>
          </tr>
          <xsl:for-each select="line">
            <xsl:variable name="currentDate"><xsl:copy-of select="."/></xsl:variable>
            <tr onmouseover="this.oldBg = this.style.backgroundColor; this.style.backgroundColor = '#eeeeee';" onmouseout="this.style.backgroundColor = this.oldBg;">
              <xsl:if test="dw = 6 or dw = 7">
                <xsl:attribute name="style">background-color: #ffcccc;</xsl:attribute>
              </xsl:if>
              <xsl:if test="dw = 1 or position() = 1">
                <td>
                  <xsl:choose>
                    <xsl:when test="dw = 1 and position() + 7 &lt;= count(../line)">
                      <xsl:attribute name="rowspan">7</xsl:attribute>
                    </xsl:when>
                  </xsl:choose>
                  <xsl:choose>
                    <xsl:when test="position() + 7 &gt; count(../line)">
                      <xsl:attribute name="rowspan"><xsl:value-of select="(count(../line) + 1) - position()"/></xsl:attribute>
                    </xsl:when>
                  </xsl:choose>
                  <xsl:choose>
                    <xsl:when test="dw &gt; 1">
                      <xsl:attribute name="rowspan"><xsl:value-of select="8 - dw"/></xsl:attribute>
                    </xsl:when>
                  </xsl:choose>
                  <xsl:value-of select="wk"/>
                </td>
              </xsl:if>
              <td>
                <xsl:value-of select="ndw"/>&#160;<xsl:value-of select="d"/>
              </td>
              <xsl:for-each select="../../employe/line">
                <xsl:variable name="emp"><xsl:value-of select="id"/></xsl:variable>
                <td onclick="ShowWeek('{msxsl:node-set($currentDate)/line/wk}', '{id}');">
                  <xsl:for-each select="../../affectation/line">
                    <xsl:variable name="dte">
                      <xsl:value-of select="concat(substring(msxsl:node-set($currentDate)/line/dte, 1, 4), substring(msxsl:node-set($currentDate)/line/dte, 6, 2), substring(msxsl:node-set($currentDate)/line/dte, 9, 2))"/>
                    </xsl:variable>
                    <xsl:variable name="datdeb">
                      <xsl:value-of select="concat(substring(datdeb, 1, 4), substring(datdeb, 6, 2), substring(datdeb, 9, 2))"/>
                    </xsl:variable>
                    <xsl:variable name="datfin">
                      <xsl:value-of select="concat(substring(datfin, 1, 4), substring(datfin, 6, 2), substring(datfin, 9, 2))"/>
                    </xsl:variable>
                    <xsl:if test="employe_id = $emp and $datdeb &lt;= $dte and $datfin &gt;= $dte and not ((msxsl:node-set($currentDate)/line/dw = 6 or msxsl:node-set($currentDate)/line/dw = 7) and we = 'N')">
                      <xsl:variable name="aff"><xsl:copy-of select="."/></xsl:variable>
                      <xsl:for-each select="../../projets/line">
                        <xsl:if test="pid = msxsl:node-set($aff)/line/projet_id">
                          <div style="width: 15px; height: 15px; background-color: {couleur}; float: left;" onmouseover="showToolTip('toolTip', '{cnom}', '{pnom}', '{msxsl:node-set($aff)/line/commentaires}');" onmouseout="hideToolTip('toolTip');">
                            <xsl:value-of select="void"/>
                          </div>
                        </xsl:if>
                      </xsl:for-each>
                    </xsl:if>
                  </xsl:for-each>
                </td>
              </xsl:for-each>
            </tr>
          </xsl:for-each>
        </table>
        <div id="toolTip" style="display: none; position: absolute; background-color: #ffffcc;"><xsl:value-of select="void"/></div>
      </xsl:when>
      <xsl:when test="/page/login/line/rights = 2">
        <input type="hidden" id="hAnnee" value="{/page/parameters/parameter[@name = 'chp:annee']/@value}"/>
        <input type="hidden" id="hMois" value="{/page/parameters/parameter[@name = 'chp:mois']/@value}"/>
        Choisissez un mois :<br/>
        Année <select name="chp:annee" id="fAnnee">
          <xsl:value-of select="void"/>
        </select> Mois <select name="chp:mois" id="fMois">
          <xsl:value-of select="void"/>
        </select>
        <div id="navPlaceHolder">
          <xsl:value-of select="void"/>
        </div>
        <br/>
        <br/>
        <table border="1" style="empty-cells: show;">
          <tr>
            <th colspan="2">
              <xsl:value-of select="line/nm"/>&#160;<xsl:value-of select="line/yyyy"/>
            </th>
            <xsl:for-each select="../employe/line">
              <th>
                <xsl:value-of select="nom"/>
              </th>
            </xsl:for-each>
          </tr>
          <xsl:for-each select="line">
            <xsl:variable name="currentDate">
              <xsl:copy-of select="."/>
            </xsl:variable>
            <tr onmouseover="this.oldBg = this.style.backgroundColor; this.style.backgroundColor = '#eeeeee';" onmouseout="this.style.backgroundColor = this.oldBg;">
              <xsl:if test="dw = 6 or dw = 7">
                <xsl:attribute name="style">background-color: #ffcccc;</xsl:attribute>
              </xsl:if>
              <xsl:if test="dw = 1 or position() = 1">
                <td>
                  <xsl:choose>
                    <xsl:when test="dw = 1 and position() + 7 &lt;= count(../line)">
                      <xsl:attribute name="rowspan">7</xsl:attribute>
                    </xsl:when>
                  </xsl:choose>
                  <xsl:choose>
                    <xsl:when test="position() + 7 &gt; count(../line)">
                      <xsl:attribute name="rowspan">
                        <xsl:value-of select="(count(../line) + 1) - position()"/>
                      </xsl:attribute>
                    </xsl:when>
                  </xsl:choose>
                  <xsl:choose>
                    <xsl:when test="dw &gt; 1">
                      <xsl:attribute name="rowspan">
                        <xsl:value-of select="8 - dw"/>
                      </xsl:attribute>
                    </xsl:when>
                  </xsl:choose>
                  <xsl:value-of select="wk"/>
                </td>
              </xsl:if>
              <td>
                <xsl:value-of select="ndw"/>&#160;<xsl:value-of select="d"/>
              </td>
              <xsl:for-each select="../../employe/line">
                <xsl:variable name="emp">
                  <xsl:value-of select="id"/>
                </xsl:variable>
                <td>
                  <xsl:for-each select="../../affectation/line">
                    <xsl:variable name="dte">
                      <xsl:value-of select="concat(substring(msxsl:node-set($currentDate)/line/dte, 1, 4), substring(msxsl:node-set($currentDate)/line/dte, 6, 2), substring(msxsl:node-set($currentDate)/line/dte, 9, 2))"/>
                    </xsl:variable>
                    <xsl:variable name="datdeb">
                      <xsl:value-of select="concat(substring(datdeb, 1, 4), substring(datdeb, 6, 2), substring(datdeb, 9, 2))"/>
                    </xsl:variable>
                    <xsl:variable name="datfin">
                      <xsl:value-of select="concat(substring(datfin, 1, 4), substring(datfin, 6, 2), substring(datfin, 9, 2))"/>
                    </xsl:variable>
                    <xsl:if test="employe_id = $emp and $datdeb &lt;= $dte and $datfin &gt;= $dte and not ((msxsl:node-set($currentDate)/line/dw = 6 or msxsl:node-set($currentDate)/line/dw = 7) and we = 'N')">
                      <xsl:variable name="aff">
                        <xsl:copy-of select="."/>
                      </xsl:variable>
                      <xsl:for-each select="../../projets/line">
                        <xsl:if test="pid = msxsl:node-set($aff)/line/projet_id">
                          <div style="width: 15px; height: 15px; background-color: {couleur}; float: left;" onmouseover="showToolTip('toolTip', '{cnom}', '{pnom}', '{msxsl:node-set($aff)/line/commentaires}');" onmouseout="hideToolTip('toolTip');">
                            <xsl:value-of select="void"/>
                          </div>
                        </xsl:if>
                      </xsl:for-each>
                    </xsl:if>
                  </xsl:for-each>
                </td>
              </xsl:for-each>
            </tr>
          </xsl:for-each>
        </table>
        <div id="toolTip" style="display: none; position: absolute; background-color: #ffffcc;">
          <xsl:value-of select="void"/>
        </div>
      </xsl:when>
      <xsl:otherwise>
        Non supporté
        <br/>
        <br/>
        <a href="mailto:administrator@manga-torii.com">Rapportez ce bug</a>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>

n°1457133
avander
Posté le 14-10-2006 à 12:27:43  profilanswer
 

respect pour ton 'usine à gaz' :jap:
 
tu généres les pages de ton site à partir d'xml c'est bien ça? Intéressant.

n°1457844
MagicBuzz
Posté le 16-10-2006 à 10:42:40  profilanswer
 

avander a écrit :

respect pour ton 'usine à gaz' :jap:
 
tu généres les pages de ton site à partir d'xml c'est bien ça? Intéressant.


En fait, c'est plus compliqué que ça ;)
 
J'ai une feuille XML qui indique quelles requêtes exécuter, avec quelles sous-requêtes exécuter, etc. Ca me génère un gros fichier XML. Et je transforme de fichier en XSL.
Le but de la manoeuvre, c'est de faire un site 100% générique et qui ne demande pas autrechose que de connaître le SQL et XML (pas de développement).

n°1457857
MagicBuzz
Posté le 16-10-2006 à 10:56:36  profilanswer
 

Ca donne ça :
 
Une "vue" :


<?xml version="1.0" encoding="utf-8" ?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://azp.manga-torii.com/schemas/view.xsd">
  <sql updatable="O">select id, nom from employe</sql>
  <filters>
    <filter name="ALL"/>
    <filter name="ID" sql="id = ?">
      <parameter name="id" sqltype="numeric" precision="18" scale="0" length="9"/>
    </filter>
  </filters>
  <sorts>
    <sort name="ID" sql="id"/>
    <sort name="NOM" sql="nom"/>
  </sorts>
</view>


Ici, une requête qui permet de retrouver la liste des employés (ou un seul, selon si on utilisera le filtre "ALL" ou "ID" ).
 
Une "page" :


<?xml version="1.0" encoding="utf-8" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://magicsite.manga-torii.com/schemas/page.xsd">
  <title>AZP : AZ Network Planning</title>
  <template name="calendrier"/>
  <views>
    <view name="V_LOGIN" output="login">
      <configuration>
        <filter name="LOGIN">
          <parameter name="password" type="input" value="user_password" default=""/>
        </filter>
      </configuration>
      <views>
        <view name="V_CALENDRIER" output="calendrier">
          <configuration>
            <filter name="MOIS">
              <parameter name="annee" type="input" value="Annee" default="1"/>
              <parameter name="mois" type="input" value="Mois" default="1"/>
            </filter>
            <sort name="DATE"/>
          </configuration>
        </view>
        <view name="V_EMPLOYE" output="employe">
          <configuration>
            <filter name="ALL"/>
            <sort name="NOM"/>
          </configuration>
        </view>
        <view name="V_PROJETS" output="projets">
          <configuration>
            <filter name="ALL"/>
          </configuration>
        </view>
        <view name="V_AFFECTATION" output="affectation">
          <configuration>
            <filter name="MOIS">
              <parameter name="mois" type="input" value="Mois" default="2000"/>
              <parameter name="annee" type="input" value="Annee" default="01"/>
            </filter>
            <sort name="DATE"/>
          </configuration>
        </view>
      </views>
    </view>
  </views>
</page>


On appelle donc les différentes vues dont on a besoin, en indiquant sur quels élément faire le lien pour les sous-requêtes.
 
Grace au tag "template", on sait donc quel XSL appliquer là-dessus (ici, c'est le XSL que j'ai mis en exemple).
 
Après l'analyse de la "page", on obtiens en fait un flux XML de ce type (assez simple à parser, faut juste s'y retrouver dans les imbrications ;))
 


<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<page debug="yes">
  <title>AZP : AZ Network Planning</title>
  <parameters>
    <parameter name="chp:wk" value="" />
    <parameter name="chp:emp" value="" />
    <parameter name="chp:annee" value="2006" />
    <parameter name="chp:mois" value="10" />
    <parameter name="chp:user_id" value="1" />
    <parameter name="chp:user_password" value="xxxxx" />
    <parameter name="chp:user_rights" value="1" />
  </parameters>
  <login>
    <line primaryKey="&lt;1&gt;">
      <id type="Decimal">1</id>
      <password type="String">xxxxx</password>
      <rights type="Int32">1</rights>
      <calendrier>
        <line primaryKey="">
          <dte type="String">2006-10-01T00:00:00</dte>
          <wk type="Int32">40</wk>
          <dw type="Int32">7</dw>
          <ndw type="String">dimanche</ndw>
          <d type="Int32">1</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-02T00:00:00</dte>
          <wk type="Int32">41</wk>
          <dw type="Int32">1</dw>
          <ndw type="String">lundi</ndw>
          <d type="Int32">2</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-03T00:00:00</dte>
          <wk type="Int32">41</wk>
          <dw type="Int32">2</dw>
          <ndw type="String">mardi</ndw>
          <d type="Int32">3</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-04T00:00:00</dte>
          <wk type="Int32">41</wk>
          <dw type="Int32">3</dw>
          <ndw type="String">mercredi</ndw>
          <d type="Int32">4</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-05T00:00:00</dte>
          <wk type="Int32">41</wk>
          <dw type="Int32">4</dw>
          <ndw type="String">jeudi</ndw>
          <d type="Int32">5</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-06T00:00:00</dte>
          <wk type="Int32">41</wk>
          <dw type="Int32">5</dw>
          <ndw type="String">vendredi</ndw>
          <d type="Int32">6</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-07T00:00:00</dte>
          <wk type="Int32">41</wk>
          <dw type="Int32">6</dw>
          <ndw type="String">samedi</ndw>
          <d type="Int32">7</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-08T00:00:00</dte>
          <wk type="Int32">41</wk>
          <dw type="Int32">7</dw>
          <ndw type="String">dimanche</ndw>
          <d type="Int32">8</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-09T00:00:00</dte>
          <wk type="Int32">42</wk>
          <dw type="Int32">1</dw>
          <ndw type="String">lundi</ndw>
          <d type="Int32">9</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-10T00:00:00</dte>
          <wk type="Int32">42</wk>
          <dw type="Int32">2</dw>
          <ndw type="String">mardi</ndw>
          <d type="Int32">10</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-11T00:00:00</dte>
          <wk type="Int32">42</wk>
          <dw type="Int32">3</dw>
          <ndw type="String">mercredi</ndw>
          <d type="Int32">11</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-12T00:00:00</dte>
          <wk type="Int32">42</wk>
          <dw type="Int32">4</dw>
          <ndw type="String">jeudi</ndw>
          <d type="Int32">12</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-13T00:00:00</dte>
          <wk type="Int32">42</wk>
          <dw type="Int32">5</dw>
          <ndw type="String">vendredi</ndw>
          <d type="Int32">13</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-14T00:00:00</dte>
          <wk type="Int32">42</wk>
          <dw type="Int32">6</dw>
          <ndw type="String">samedi</ndw>
          <d type="Int32">14</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-15T00:00:00</dte>
          <wk type="Int32">42</wk>
          <dw type="Int32">7</dw>
          <ndw type="String">dimanche</ndw>
          <d type="Int32">15</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-16T00:00:00</dte>
          <wk type="Int32">43</wk>
          <dw type="Int32">1</dw>
          <ndw type="String">lundi</ndw>
          <d type="Int32">16</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-17T00:00:00</dte>
          <wk type="Int32">43</wk>
          <dw type="Int32">2</dw>
          <ndw type="String">mardi</ndw>
          <d type="Int32">17</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-18T00:00:00</dte>
          <wk type="Int32">43</wk>
          <dw type="Int32">3</dw>
          <ndw type="String">mercredi</ndw>
          <d type="Int32">18</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-19T00:00:00</dte>
          <wk type="Int32">43</wk>
          <dw type="Int32">4</dw>
          <ndw type="String">jeudi</ndw>
          <d type="Int32">19</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-20T00:00:00</dte>
          <wk type="Int32">43</wk>
          <dw type="Int32">5</dw>
          <ndw type="String">vendredi</ndw>
          <d type="Int32">20</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-21T00:00:00</dte>
          <wk type="Int32">43</wk>
          <dw type="Int32">6</dw>
          <ndw type="String">samedi</ndw>
          <d type="Int32">21</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-22T00:00:00</dte>
          <wk type="Int32">43</wk>
          <dw type="Int32">7</dw>
          <ndw type="String">dimanche</ndw>
          <d type="Int32">22</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-23T00:00:00</dte>
          <wk type="Int32">44</wk>
          <dw type="Int32">1</dw>
          <ndw type="String">lundi</ndw>
          <d type="Int32">23</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-24T00:00:00</dte>
          <wk type="Int32">44</wk>
          <dw type="Int32">2</dw>
          <ndw type="String">mardi</ndw>
          <d type="Int32">24</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-25T00:00:00</dte>
          <wk type="Int32">44</wk>
          <dw type="Int32">3</dw>
          <ndw type="String">mercredi</ndw>
          <d type="Int32">25</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-26T00:00:00</dte>
          <wk type="Int32">44</wk>
          <dw type="Int32">4</dw>
          <ndw type="String">jeudi</ndw>
          <d type="Int32">26</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-27T00:00:00</dte>
          <wk type="Int32">44</wk>
          <dw type="Int32">5</dw>
          <ndw type="String">vendredi</ndw>
          <d type="Int32">27</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-28T00:00:00</dte>
          <wk type="Int32">44</wk>
          <dw type="Int32">6</dw>
          <ndw type="String">samedi</ndw>
          <d type="Int32">28</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-29T00:00:00</dte>
          <wk type="Int32">44</wk>
          <dw type="Int32">7</dw>
          <ndw type="String">dimanche</ndw>
          <d type="Int32">29</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-30T00:00:00</dte>
          <wk type="Int32">45</wk>
          <dw type="Int32">1</dw>
          <ndw type="String">lundi</ndw>
          <d type="Int32">30</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
        <line primaryKey="">
          <dte type="String">2006-10-31T00:00:00</dte>
          <wk type="Int32">45</wk>
          <dw type="Int32">2</dw>
          <ndw type="String">mardi</ndw>
          <d type="Int32">31</d>
          <m type="Int32">10</m>
          <nm type="String">octobre</nm>
          <yyyy type="Int32">2006</yyyy>
        </line>
      </calendrier>
      <employe>
        <line primaryKey="&lt;9&gt;">
          <id type="Decimal">9</id>
          <nom type="String">Alex</nom>
        </line>
        <line primaryKey="&lt;15&gt;">
          <id type="Decimal">15</id>
          <nom type="String">Bertrand</nom>
        </line>
        <line primaryKey="&lt;11&gt;">
          <id type="Decimal">11</id>
          <nom type="String">Christophe</nom>
        </line>
        <line primaryKey="&lt;18&gt;">
          <id type="Decimal">18</id>
          <nom type="String">David</nom>
        </line>
        <line primaryKey="&lt;12&gt;">
          <id type="Decimal">12</id>
          <nom type="String">Florence</nom>
        </line>
        <line primaryKey="&lt;10&gt;">
          <id type="Decimal">10</id>
          <nom type="String">Henri</nom>
        </line>
        <line primaryKey="&lt;16&gt;">
          <id type="Decimal">16</id>
          <nom type="String">Olivier</nom>
        </line>
        <line primaryKey="&lt;13&gt;">
          <id type="Decimal">13</id>
          <nom type="String">Renaud</nom>
        </line>
        <line primaryKey="&lt;7&gt;">
          <id type="Decimal">7</id>
          <nom type="String">Sylvain</nom>
        </line>
        <line primaryKey="&lt;14&gt;">
          <id type="Decimal">14</id>
          <nom type="String">Thomas</nom>
        </line>
        <line primaryKey="&lt;17&gt;">
          <id type="Decimal">17</id>
          <nom type="String">Yann</nom>
        </line>
      </employe>
      <projets>
        <line primaryKey="&lt;1&gt;,&lt;1&gt;">
          <cid type="Decimal">1</cid>
          <cnom type="String">*</cnom>
          <couleur type="String">#ff0000</couleur>
          <pid type="Decimal">1</pid>
          <pnom type="String">Non affecté</pnom>
          <termine type="String">N</termine>
        </line>
        <line primaryKey="&lt;6&gt;,&lt;2&gt;">
          <cid type="Decimal">6</cid>
          <cnom type="String">Férié</cnom>
          <couleur type="String">#7f7f7f</couleur>
          <pid type="Decimal">2</pid>
          <pnom type="String">WE</pnom>
          <termine type="String">N</termine>
        </line>
        <line primaryKey="&lt;6&gt;,&lt;3&gt;">
          <cid type="Decimal">6</cid>
          <cnom type="String">Férié</cnom>
          <couleur type="String">#7f7f7f</couleur>
          <pid type="Decimal">3</pid>
          <pnom type="String">Férier</pnom>
          <termine type="String">N</termine>
        </line>
        <line primaryKey="&lt;4&gt;,&lt;4&gt;">
          <cid type="Decimal">4</cid>
          <cnom type="String">abc</cnom>
          <couleur type="String">#f4c500</couleur>
          <pid type="Decimal">4</pid>
          <pnom type="String">TMA</pnom>
          <termine type="String">N</termine>
        </line>
        <line primaryKey="&lt;3&gt;,&lt;5&gt;">
          <cid type="Decimal">3</cid>
          <cnom type="String">Congés</cnom>
          <couleur type="String">#ff7f7f</couleur>
          <pid type="Decimal">5</pid>
          <pnom type="String">CP</pnom>
          <termine type="String">N</termine>
        </line>
        <line primaryKey="&lt;4&gt;,&lt;6&gt;">
          <cid type="Decimal">4</cid>
          <cnom type="String">abc</cnom>
          <couleur type="String">#f4c500</couleur>
          <pid type="Decimal">6</pid>
          <pnom type="String">Migration</pnom>
          <termine type="String">N</termine>
        </line>
        <line primaryKey="&lt;14&gt;,&lt;7&gt;">
          <cid type="Decimal">14</cid>
          <cnom type="String">Veille</cnom>
          <couleur type="String">#ff2896</couleur>
          <pid type="Decimal">7</pid>
          <pnom type="String">AZP</pnom>
          <termine type="String">N</termine>
        </line>
        <line primaryKey="&lt;5&gt;,&lt;8&gt;">
          <cid type="Decimal">5</cid>
          <cnom type="String">aze</cnom>
          <couleur type="String">#a0bcff</couleur>
          <pid type="Decimal">8</pid>
          <pnom type="String">xxx</pnom>
          <termine type="String">N</termine>
        </line>
      </projets>
      <affectation>
        <line primaryKey="">
          <id type="Decimal">1</id>
          <orideb type="DateTime">03/07/2006 00:00:00</orideb>
          <orifin type="DateTime">01/10/2006 00:00:00</orifin>
          <datdeb type="String">2006-07-03T00:00:00</datdeb>
          <datfin type="String">2006-10-01T00:00:00</datfin>
          <ddeb type="Int32">3</ddeb>
          <mdeb type="Int32">7</mdeb>
          <yyyydeb type="Int32">2006</yyyydeb>
          <dfin type="Int32">1</dfin>
          <mfin type="Int32">10</mfin>
          <yyyyfin type="Int32">2006</yyyyfin>
          <employe_id type="Decimal">7</employe_id>
          <projet_id type="Decimal">4</projet_id>
          <commentaires type="String">Troisième trimestre</commentaires>
          <we type="String">N</we>
          <heudeb type="Decimal">9</heudeb>
          <heufin type="Decimal">18</heufin>
          <pause type="Decimal">2</pause>
        </line>
        <line primaryKey="">
          <id type="Decimal">3</id>
          <orideb type="DateTime">25/09/2006 00:00:00</orideb>
          <orifin type="DateTime">01/10/2006 00:00:00</orifin>
          <datdeb type="String">2006-09-25T00:00:00</datdeb>
          <datfin type="String">2006-10-01T00:00:00</datfin>
          <ddeb type="Int32">25</ddeb>
          <mdeb type="Int32">9</mdeb>
          <yyyydeb type="Int32">2006</yyyydeb>
          <dfin type="Int32">1</dfin>
          <mfin type="Int32">10</mfin>
          <yyyyfin type="Int32">2006</yyyyfin>
          <employe_id type="Decimal">7</employe_id>
          <projet_id type="Decimal">7</projet_id>
          <commentaires type="String">Quand j ai le temps</commentaires>
          <we type="String">O</we>
          <heudeb type="Decimal">20</heudeb>
          <heufin type="Decimal">23</heufin>
          <pause type="Decimal">0</pause>
        </line>
        <line primaryKey="">
          <id type="Decimal">4</id>
          <orideb type="DateTime">02/10/2006 00:00:00</orideb>
          <orifin type="DateTime">31/12/2006 00:00:00</orifin>
          <datdeb type="String">2006-10-02T00:00:00</datdeb>
          <datfin type="String">2006-12-31T00:00:00</datfin>
          <ddeb type="Int32">2</ddeb>
          <mdeb type="Int32">10</mdeb>
          <yyyydeb type="Int32">2006</yyyydeb>
          <dfin type="Int32">31</dfin>
          <mfin type="Int32">12</mfin>
          <yyyyfin type="Int32">2006</yyyyfin>
          <employe_id type="Decimal">7</employe_id>
          <projet_id type="Decimal">4</projet_id>
          <commentaires type="String">Quatrième trimestre TMA</commentaires>
          <we type="String">N</we>
          <heudeb type="Decimal">9</heudeb>
          <heufin type="Decimal">18</heufin>
          <pause type="Decimal">2</pause>
        </line>
        <line primaryKey="">
          <id type="Decimal">5</id>
          <orideb type="DateTime">23/10/2006 00:00:00</orideb>
          <orifin type="DateTime">23/10/2006 00:00:00</orifin>
          <datdeb type="String">2006-10-23T00:00:00</datdeb>
          <datfin type="String">2006-10-23T00:00:00</datfin>
          <ddeb type="Int32">23</ddeb>
          <mdeb type="Int32">10</mdeb>
          <yyyydeb type="Int32">2006</yyyydeb>
          <dfin type="Int32">23</dfin>
          <mfin type="Int32">10</mfin>
          <yyyyfin type="Int32">2006</yyyyfin>
          <employe_id type="Decimal">7</employe_id>
          <projet_id type="Decimal">5</projet_id>
          <commentaires type="String">tests</commentaires>
          <we type="String">N</we>
          <heudeb type="Decimal">9</heudeb>
          <heufin type="Decimal">18</heufin>
          <pause type="Decimal">2</pause>
        </line>
      </affectation>
    </line>
  </login>
</page>


Ce qui après transformation donne dans mon cas un beau calendrier comme outlook dans lequel on voit qui est affecté où quel jour, le tout étant facilement modifiable grâce à la clause "updatable" de la "vue" : en récupérant automatiquement l'éventuelle PK associée aux données retournées par la requête, on est en mesure de traîter automatiquement les valeurs modifiées :)
 
 
Genre :
http://magicsite.manga-torii.com
=> Sur la première page tu peux ajouter/supprimer/modifier des données dans le tableau. Bah c'est 100% sans une ligne de code (c'est bien pratique ;))


Message édité par MagicBuzz le 16-10-2006 à 10:57:32

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  XML/XSL

  for-each imbriqués[resolu]

 

Sujets relatifs
Un problème simple[résolu][RESOLU] Réinitialiser une ListBox
Classes imbriquées [résolu][VBA excel] Récupérer dans 1 listbox le resultat d'1 AutoFilter!résolu
[Batch] [Résolu] Copie de fichiers listés dans un .txt[RESOLU] tab multidimensionel en paramètre d'une fonction
[Résolu] [C#] Création puis ouverture d'un fichier => problème[Résolu] Enregistrement d'animation
[RESOLU] Menu déroulant en HTML[Résolu] MMORPG en java
Plus de sujets relatifs à : for-each imbriqués[resolu]


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR