[resolu] nombre de noeuds correspondants à plusieurs critères

nombre de noeuds correspondants à plusieurs critères [resolu] - XML/XSL - Programmation

Marsh Posté le 27-06-2006 à 17:10:45    

Bonjour,
 
j'espère que vous pourrez m'aider,
 
pour commencer voici à quoi ressemble mon fichier xml  

Code :
  1. <fiches>
  2. [...]
  3.    <fiche id="L1UE1">
  4.       <cycle id="L"/>
  5.       <promo id="1"/>
  6.    </fiche>
  7. [...]
  8. </fiches>


 
Je voudrais savoir combien j'ai d'élément dans mon fichier qui ont un cycle = "L"    ET   une promo = "1"
j'ai essayé :
<xsl:variable name="nbL1" select="count(//cycle[@id='L'] and //promo[@id='1'])" />  
ou encore  
<xsl:variable name="nbL1" select="count(contains(/fiche[@id],'L1'))" />
 
mais aucun ne fonctionne.
 
j'ai l'erreur suivante :
Warning: process(): Invalid type in ...
Warning: process(): runtime error: element variable ...
Warning: process(): Evaluating variable nbL1 failed in ...
 
Merci de votre aide.


Message édité par cline68 le 27-06-2006 à 17:20:55
Reply

Marsh Posté le 27-06-2006 à 17:10:45   

Reply

Marsh Posté le 27-06-2006 à 17:14:57    

 
j'essaierai :  
 

Code :
  1. <xsl:variable name="nbL1" select="count(//fiche[./cycle/@id='L' and ./promo/@id='1'])" />

 

Reply

Marsh Posté le 27-06-2006 à 17:21:13    

Super !!
 
Ca fonctionne.
Grand merci  
:-)

Reply

Sujets relatifs:

Leave a Replay

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