我有以下 xml 片段。
<root>
<site type="main">
<link>http://stackexchange.com</link>
</site>
<site type="qa">
<link>http://stackoverflow.com</link>
</site>
<site type="qa">
<link>http://superuser.com</link>
</site>
<site type="">
<link>http://data.stackexchange.com</link>
</site>
</root>
我想选择“qa”类型的第一个站点的链接。我认为//site[@type="qa"][1]
应该这样做。但是 id 不起作用。