Sie sind auf Seite 1von 4

Solution de l’Exercice 1:

/child::liste_acteurs/child::acteur
/liste_acteurs/acteur
/descendant::acteur
//acteur

count(/child::liste_acteurs/child::acteur)
count(/liste_acteurs/acteur)
count(/descendant::acteur)
count(//acteur)

/descendant::comment()
//comment()

/descendant::comment()[position()=2]
//comment()[2] NON !!!

/descendant::acteur[position()=1]/node()[position()=1]
//acteur[1]/node()[1]
Le premier noeud fils de tous les noeud acteur ;
//acteur[1]/node()[1]

/descendant::acteur[position()=2]/node()[position()=1]
//acteur[2]/node()[1]

/descendant::acteur/*[position()=1 or position()=2]
//acteur/*[position()<=2]

/descendant::acteur/*[position()=last()]
//acteur/*[last()]

/descendant::acteur[attribute::id='clint']
//acteur[@id='clint']

/descendant::acteur[child::prenom/text()='Clint']
//acteur[prenom='Clint']

/descendant::acteur/child::biographie/child::p[last()=2]/parent::biographie/parent::acteur/child::nom/text()
//acteur/biographie/p[last()=2]/../../nom/text()
/descendant::acteur/child::biographie/child::p[last()=2]/ancestor::acteur/child::nom/text()

/descendant::acteur/child::nom/child::text()[count(ancestor::acteur/child::biographie/child::p)=2]
//acteur/nom/text()[count(../../biographie/p)=2]
Solution de l’Exercice 2:
1. Le nom des pays de plus que 6.000.000 habitants.
//country[population>6000000]/name

2Le code de pays qui a le plus longue frontière avec l’Algérie


//country[name='Algeria']/border[@length=max(//country[name='Algeria']/border/@length)]/@country

3. Le nombre de pays qui sont toujours dépendant de la chine (CN).


count(//country/dependent[@country='CN'])

4. L’organisation qui regroupe le plus grand nombre de membres


//organization[count(members/member)=max(//organization/members/count(member))]

5.le nom de tous les pays africains qui prennent leur indépendance de la France
// country [indep_date[@from=//country[name/text()='France']/@car_code]][encompassed
[@continent="africa"]]/name

6. La date l'indépendance du pays qui accueille l'organisation nommée “League of Arab States”
//country[@capital=//organization[name='League of Arab States']/@headq]/indep_date

7. Le nom des pays qui n’ont aucune frontière (exemple Madagascar)


//country[not(border)]

8 Le nombre du musulmans dans la chine


(//country[name="China"]/religion[.="Muslim"]/@percentage *
//country[name="China"]/population[last()]) div 100
Solution de l’Exercice 3:

1. Les journées précédant la 8ème ;


/descendant::JOURNEE[attribute::NUMERO < 8]
/descendant::JOURNEE[attribute::NUMERO=8]/preceding-sibling::JOURNEE
//JOURNEE[@NUMERO < 8]
//JOURNEE[@NUMERO=8]/preceding-sibling::JOURNEE

2. Les rencontres de la 2ème journée ;


/descendant::JOURNEE[attribute::NUMERO=2]/child::RENCONTRE
//JOURNEE[@NUMERO=2]/RENCONTRE

3. La première rencontre de chacune des journées ;


/descendant::JOURNEE/child::RENCONTRE[position()=1]
//JOURNEE/RENCONTRE[1]

4. L'adversaire de equipeA lors de la journée 1 ;


//JOURNEE[@NUMERO=1]/RENCONTRE[@DOMICILE='equipeA']/@EXTERIEUR
|
//JOURNEE[@NUMERO=1]/RENCONTRE[@EXTERIEUR='equipeA']/@DOMICILE

/descendant::JOURNEE[attribute::NUMERO=1]/child::RENCONTRE[attribute::DOMICILE='equipeA']/attribute::E
XTERIEUR
|
/descendant::JOURNEE[attribute::NUMERO=1]/child::RENCONTRE[attribute::EXTERIEUR='equipeA']/attribute::
DOMICILE

5. Tous les adversaires de equipeA ;


//RENCONTRE[@DOMICILE='equipeA']/@EXTERIEUR
|
//RENCONTRE[@EXTERIEUR='equipeA']/@DOMICILE

/descendant::RENCONTRE[attribute::DOMICILE='equipeA']/attribute::EXTERIEUR
|
/descendant::RENCONTRE[attribute::EXTERIEUR='equipeA']/attribute::DOMICILE

6. La liste des matches non joués ;


//RENCONTRE[@SCORED='-']

/descendant::RENCONTRE[attribute::SCORED='-']

7. Les matches nuls de equipeA à domicile ;

//RENCONTRE[@DOMICILE='equipeA' and @SCORED!='-' and @SCORED=@SCOREE]

/descendant::RENCONTRE[attribute::DOMICILE='equipeA' and attribute::SCORED!='-'


and attribute::SCORED=attribute::SCOREE]

8. Le nombre et le pourcentage de matches nuls sur l'ensemble du championnat ;


count(//RENCONTRE[@SCORED!='-' and @SCORED=@SCOREE])
count(/descendant::RENCONTRE[attribute::SCORED!='-' and attribute::SCORED=attribute::SCOREE])

9. Le nombre et le pourcentage de victoires à domicile ;


100*count(//RENCONTRE[@SCORED!='-' and @SCORED=@SCOREE]) div
count(//RENCONTRE[@SCORED!='-'])

count(//RENCONTRE[@SCORED>@SCOREE])

100 .* count(/descendant::RENCONTRE[attribute::SCORED!='-' and attribute::SCORED=attribute::SCOREE])


div count(/descendant::RENCONTRE[attribute::SCORED!='-'])

count(/descendant::RENCONTRE[attribute::SCORED>attribute::SCOREE])
10. Le nombre et le pourcentage de victoires à l'extérieur.

100*count(//RENCONTRE[@SCORED>@SCOREE]) div count(//RENCONTRE[@SCORED!='-'])

count(//RENCONTRE[@SCORED<@SCOREE])

100 * count(/descendant::RENCONTRE[attribute::SCORED>attribute::SCOREE])
div count(/descendant::RENCONTRE[attribute::SCORED!='-'])

count(/descendant::RENCONTRE[attribute::SCORED<attribute::SCOREE])

Das könnte Ihnen auch gefallen