xslt/xpath conditions sur tous les fils

xslt/xpath conditions sur tous les fils - XML/XSL - Programmation

Marsh Posté le 30-10-2007 à 11:52:55    

Bonjour,
j'ai un document de la forme  

Code :
  1. <doc>
  2. <article id='1' >
  3. <a> toto </a>
  4. <a b="1"> titi </a>
  5. </article>
  6. <article id='2'>
  7. <a b="1"> tutu</a>
  8. <a b="uu"> tata </a>
  9. </article>
  10. ...
  11. </doc>


 
j'ai une feuille de style xsl et je voudrais faire un traitement sur article uniquement si tous ces fils a ont un atribut b présent.
 

Code :
  1. <xsl:template match="article">
  2.           <xsl:if test="a[@b]">
  3.            </xsl:if>
  4. </xsl:template>


 
Ce code fonctionne si au moins un a avec un b est présent...


Message édité par cyplp le 30-10-2007 à 11:54:17
Reply

Marsh Posté le 30-10-2007 à 11:52:55   

Reply

Marsh Posté le 30-10-2007 à 12:10:00    

count(a[@b]) = count(a)


---------------
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?
Reply

Marsh Posté le 30-10-2007 à 12:12:35    

ah oui c'est assez simple en fait  
merci beaucoup.

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed