<listings>
<property rln="r317080" firm="f102" agent="a2140">
<street>2638 Maple Avenue</street>
<city>Padua</city>
<state>WI</state>
<zip>53701</zip>
<price>229000</price>
<style>2 Story Contemporary, Transitional</style>
<sqfeet>2328</sqfeet>
<bathrooms>2 1/2</bathrooms>
<bedrooms>4</bedrooms>
<garage>2 car, attached</garage>
<age>22</age>
<description>Very nice home on a one block dead end street with woods nearby.
Very special location for quiet and privacy! Home features open floor plan with
large rooms - new patio doors to pretty yard. updates: shingles, vinyl siding,
refrig and dishwasher, garage door. Fireplace in family room flanked by great
built-ins. add first floor laundry and award winning Padua schools.
</description>
</property>
<property ...>
<city>Broxton</city>
...
</property>
<property ...>
<city>Cutler</city>
...
</property>
<property ...>
<city>Argyle</city>
...
</property>
<property ...>
<city>Stratmore</city>
...
</property>
<property ...>
<city>Padua</city>
...
</property>
<property ...>
<city>Oseola</city>
...
</property>
<property ...>
<city>Fenmore</city>
...
</property>
<property ...>
<city>Cutler</city>
...
</property>
<property ...>
<city>Padua</city>
...
</property>
<property ...>
<city>Cutler</city>
...
</property>
<property ...>
<city>Oseola</city>
...
</property>
</listings>
在我的教科书(Patrick Carey 的 XML 第 2 版)中,它提供了一个使用“Muenchian Grouping”来查找唯一选择的示例。我不明白的部分是:
它到了这里,在示例的进程中它指出:“ property[generate-id()=generate-id(key("cityNames", "Cutler" )[1])] ”它说这会找到由于索引“[1]”,选择中的第一个“Cutler”。鉴于上面的 XML 将返回“Cutler”
现在示例进展为:“ property[generate-id()=generate-id(key("cityNames", city )[1])] ”这表示这将找到第一个也是唯一一个(因此是唯一的)键内的每个城市。创造了所有城市内部的一组独特价值。鉴于上面的 XML 将返回“Argyle Broxton Cutler Fenmore Padua Stratmore Oseola” (注意没有倍数)。
现在,我的问题是:为什么第二个语句返回一系列值,而不仅仅是一个?
谢谢