j'ai commencé étudier XML et XSLT. J'ai lu plusieurs tutoriels sur internet. J'ai une question. Je voudrais savoir quelle est la difference entre le premier code et le deuxiem.

Voilà mon fichier xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="esametest.xsl"?>
<site>
<regions>
<europe>
           <item id="item0">
    <location>United States</location>
    <quantity>1</quantity>
    <name>dueteous nine eighteen</name>
    <payment>Credicard</payment>
    <description>
    <parlist>
    <listitem>
    <text>fghj<keyword>ghjkg</keyword></text>
    </listitem>
    <listitem>
    <text>fghjgfjhgf</text>
    </listitem>
    </parlist>
    </description>
    <shipping>Will ship internationally, see description for charges</shipping>
    <incattegory category="category540"/>
    <incattegory category="category418"/>
    <mailbox>
    <mail>
    <from>Libero Rive mailto:Rive@hitachi.com</from>
    <to>Benidikte Glew mailto:Glew@sds.no</to>
    <date>08/05/1999</date>
    </mail>
    </mailbox>
    </item>
    <item id="item1">
    <location> Moldova,Republic Of </location>
    <quantity>1</quantity>
    <name>condemn</name>
    <payment>Money order,Creditcard,Cash</payment>
    <description>
    <text>ggjhljkhllkjhkh</text>
    </description>
    <shipping>Will ship only within country, see description for charges</shipping>
    <incattegory category="category966"/>
    <incattegory category="category488"/>
    <incattegory category="category741"/>
    <mailbox>
    <mail>
    <from>Javam Suwanda mailto:Suwanda@gmu.edu</from>
    <to>Mehrdad Glew mailto:Glew@cohera.com</to>
    <date>11/28/1999</date>
    </mail>
    </mailbox>
    </item>
</europe>
</regions>
<people>
            <person id="person21337">
            <name>Cedric Truscott</name>
           <emailadress>mailto:Truscott@ualberta.ca</emailadress>
           <credicard>7035 9867 9348 9586</credicard>
           <profile income="36231.86">
           <interest category="category390"/>
    <interest category="category851"/>
    <education>College</education>
    <business>No</business>
    </profile>
    <watches>
    <watch open_auction="open_auction2188"/>
    </watches>
    </person>
 
    <person id="person21338">
    <name>Urban Rosencrans</name>
    <emailadress>mailto:Rosencrans@edu.hk</emailadress>
    <phone>+68(987)78805084</phone>
    <address>
    <street>38 Motoki St</street>
    <city>Moscow</city>
    <country>United States</country>
    <zipcode>17</zipcode>
    </address>
    <creditcard>7312 7037 5289 9748</creditcard>
    <watches>
    <watch open_auction="open_auction2187"/>
    <watch open_auction="open_auction2188"/>
    </watches>
    </person>
</people>
<open_auctions>
          <open_auction id="open_auction2187">
          <initial>101.80</initial>
          <reserve>221.72</reserve>
          <bidder>
          <date>07/07/1999</date>
          <time>22:51:</time>
          <personref  person="person21337"/>
          <increase>4.50</increase>
          </bidder>
          <current>106.30</current>
          <itemref  item="item0"/>
          <seller person="person12397"/>
          <annotation>
          <author person="person10286"/>
          <description>
          <text>poiuytrezasdfghjkk</text>
          </description>
          <happiness>3</happiness> 
          </annotation>
          <quantity>2</quantity>
          <type>Featured</type>
          <interval>
          <start>07/26/2000</start>
          <end>11/09/1999</end>
         </interval>
         </open_auction>
 
         <open_auction id="open_auction2188">
         <initial>78.23</initial>
         <bidder>
         <date>03/05/1998</date>
         <time>14:00:51</time>
         <personref  person="person21338"/>
  <increase>16.50</increase>
  </bidder>
  <current>94.73</current>
  <privacy>No</privacy>
  <itemref item="item1"/>
  <seller person="person14886"/>
  <annotation>
  <author person="person21737"/>
  <description>
  <text> iuopiu<bold>iiuiuy</bold>ghfg</text>
  </description>
  <hapiness>8</hapiness>
  </annotation>
  <quantity>1</quantity>
  <type>Featured</type>
  <interval>
  <start>07/05/2000</start>
  <end>12/21/2000</end>
  </interval>
  </open_auction>
</open_auctions> 
 
  <closed_auctions>
         <closed_auction>
         <seller person="person14861"/>
         <buyer  person="person9374"/>
         <itemref item="item19545"/>
         <price>54.17</price>
         <date>11/07/1988</date>
         <quantity>1</quantity>
         <type>Regular</type>
         <annotation>
         <author  person="person2043"/>
         <description>
         <text>vvvvvvv<bold>hghfjkiuyt</bold>jhggfffff</text>
  </description>
  <hapiness>9</hapiness>
  </annotation>
  </closed_auction>
</closed_auctions>
 
</site>


Je voudrais afficher la balise "address" de la deuxième personne.

Le premier code XSLT ne marche pas :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<xsl:value-of select = "site/people/person[2]/address">
</xsl:template>
</xsl:stylesheet>

Mais ce code marche :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
  <xsl:for-each select = "site/people">
   <xsl:value-of select = "person[2]/address"/>
  </xsl:for-each>
 
</xsl:template>
</xsl:stylesheet>

Quelle est la difference?

Merci