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

  FORUM HardWare.fr
  Programmation
  XML/XSL

  transformation xml et mauvais balisage

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

transformation xml et mauvais balisage

n°1827407
leod38
Posté le 15-12-2008 à 15:42:06  profilanswer
 

Bonjour a tous
 
voici mon code "mal formé" :
 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
        <PROJ_Name>
          <xsl:for-each select="PROJ_Name/PERS_Name">
            <xsl:if test="not(preceding::PROJ_Name/PERS_Name/PROJ_Name = PROJ_Name)">
              <PERS_Name2>
                <PROJ_Type><xsl:value-of select="PROJ_Type"/></PROJ_Type>
                <PROJ_Name><xsl:value-of select="PROJ_Name"/></PROJ_Name>
                <PROJ_State><xsl:value-of select="PROJ_State"/></PROJ_State>  
                <PROJ_Policy><xsl:value-of select="PROJ_Policy"/></PROJ_Policy>  
                <PROJ_Description><xsl:value-of select="PROJ_Description"/></PROJ_Description>  
                <PROJ_Owner><xsl:value-of select="PROJ_Owner"/></PROJ_Owner>
                <PERS>
                  <PERS_Name>  
                    <PERS_Type><xsl:value-of select="PERS_Type"/></PERS_Type>  
                    <PERS_State><xsl:value-of select="PERS_State"/></PERS_State>  
                    <PERS_Policy><xsl:value-of select="PERS_Policy"/></PERS_Policy>  
                    <PERS_Description><xsl:value-of select="PERS_Description"/></PERS_Description>
                  </PERS_Name>
            </xsl:if>
            <xsl:if test="preceding::PROJ_Name/PERS_Name/PROJ_Name = PROJ_Name">
              <PERS_Name>
                <PERS_Type><xsl:value-of select="PERS_Type"/></PERS_Type>  
                <PERS_State><xsl:value-of select="PERS_State"/></PERS_State>  
                <PERS_Policy><xsl:value-of select="PERS_Policy"/></PERS_Policy>  
                <PERS_Description><xsl:value-of select="PERS_Description"/></PERS_Description>
              </PERS_Name>
              <xsl:if test="not(following::PROJ_Name/PERS_Name/PROJ_Name = PROJ_Name)">
                   </PERS>
                 </PERS_Name2>
              </xsl:if>
            </xsl:if>
          </xsl:for-each>
        </PROJ_Name>
    </xsl:template>
</xsl:stylesheet>
 
je sais qu'en xsl on ne peu fermer les balises de cet facon
mais comment puis je faire pour que ca marche ?
 
vous l'aurez compris je cherche juste a factoriser :
 
passer de ca :
 
<PROJ_Name>
- <PERS_Name>
  <PROJ_Type>Project Space</PROJ_Type>  
  <PROJ_Name>88700</PROJ_Name>  
  <PROJ_State>Complete</PROJ_State>  
  <PROJ_Policy>Project Space</PROJ_Policy>  
  <PROJ_Description>OneZig SW</PROJ_Description>  
  <PROJ_Owner>daniel.thommen</PROJ_Owner>  
  <PERS_Type>Person</PERS_Type>  
  <PERS_Name>daniel.thommen</PERS_Name>  
  <PERS_State>Active</PERS_State>  
  <PERS_Policy>Person</PERS_Policy>  
  <PERS_Description />  
  </PERS_Name>
- <PERS_Name>
  <PROJ_Type>Project Space</PROJ_Type>  
  <PROJ_Name>88700</PROJ_Name>  
  <PROJ_State>Complete</PROJ_State>  
  <PROJ_Policy>Project Space</PROJ_Policy>  
  <PROJ_Description>OneZig SW</PROJ_Description>  
  <PROJ_Owner>daniel.thommen</PROJ_Owner>  
  <PERS_Type>Person</PERS_Type>  
  <PERS_Name>fabian.buschor</PERS_Name>  
  <PERS_State>Active</PERS_State>  
  <PERS_Policy>Person</PERS_Policy>  
  <PERS_Description />  
  </PERS_Name>
- <PERS_Name>
  <PROJ_Type>Project Space</PROJ_Type>  
  <PROJ_Name>BB MC Application 1</PROJ_Name>  
  <PROJ_State>Archive</PROJ_State>  
  <PROJ_Policy>Project Space</PROJ_Policy>  
  <PROJ_Description>BlueBerry MC</PROJ_Description>  
  <PROJ_Owner>patrice.declementi</PROJ_Owner>  
  <PERS_Type>Person</PERS_Type>  
  <PERS_Name>patrice.declementi</PERS_Name>  
  <PERS_State>Active</PERS_State>  
  <PERS_Policy>Person</PERS_Policy>  
  <PERS_Description />  
  </PERS_Name>
</PROJ_Name>
 
a ceci :
 
<PROJ_Name>
- <PERS_Name2>
  <PROJ_Type>Project Space</PROJ_Type>  
  <PROJ_Name>88700</PROJ_Name>  
  <PROJ_State>Complete</PROJ_State>  
  <PROJ_Policy>Project Space</PROJ_Policy>  
  <PROJ_Description>OneZig SW</PROJ_Description>  
  <PROJ_Owner>daniel.thommen</PROJ_Owner>  
- <PERS>
- <PERS_Name>
  daniel.thommen  
  <PERS_Type>Person</PERS_Type>  
  <PERS_State>Active</PERS_State>  
  <PERS_Policy>Person</PERS_Policy>  
  <PERS_Description />  
  </PERS_Name>
- <PERS_Name>
  fabian.buschor  
  <PERS_Type>Person</PERS_Type>  
  <PERS_State>Active</PERS_State>  
  <PERS_Policy>Person</PERS_Policy>  
  <PERS_Description />  
  </PERS_Name>
  </PERS>
</PERS_Name2>
 ....
<PROJ_Name>
 
merci d'avance de l'aide que vous pourriez m'apporter
désolé pour le double post mais je voulai bien décrire mon probleme

mood
Publicité
Posté le 15-12-2008 à 15:42:06  profilanswer
 

n°1827450
masklinn
í dag viðrar vel til loftárása
Posté le 15-12-2008 à 16:20:39  profilanswer
 

leod38 a écrit :

je sais qu'en xsl on ne peu fermer les balises de cet facon
mais comment puis je faire pour que ca marche ?


Faut faire des regroupements, si tu utilises un processeur XSLT 2.0 c'est pas très dûr à faire, par contre si ton processeur c'est du XSLT 1.0 t'es parti pour te taper du muenchian, et c'est pas exactement le truc le plus drole du monde.
 
Amuses toi bien.


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1827471
leod38
Posté le 15-12-2008 à 16:44:23  profilanswer
 

merci pour les liens
j'ai l'impression d'etre malheureusement en 1.0
 
quelqu'un serai motivé pour me faire un exemple simple avec muenchian
car je debute totalement et ne comprend pas grand chose


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

  transformation xml et mauvais balisage

 

Sujets relatifs
Transformation Tableau en Liste de DonnéesTransformation des attributs xml sous vba excel
Transformation XSLT en Javascript[Résolu][Lex] reconnaitre un mauvais identifiant
[Ocaml-Sdl] Transformation d'une image en nuance de gris[Resolu] Transformation d'un fichier en liste doublement chainée
XSLT - Transformation d'un fichier XMLTransformation TAR vers ZIP
mauvais departphp5, transformation XSLT, chunk.xsl et path des output
Plus de sujets relatifs à : transformation xml et mauvais balisage


Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)