如何获取xml属性值

How to get the xml attribute value

我有一个生成这样输出的聚合,但我需要使用 xpath 从密钥中获取名称,我是新手 xml,请指教。

<Aggregation name="area">
      <Set key="name">
        <Entry key="docCount">20</Entry>
      </Set>
      <Set key="name1">
        <Entry key="docCount">16</Entry>
      </Set>
      <Set key="name2">
        <Entry key="docCount">12</Entry>
      </Set>
      </Aggregation>

谢谢

最后,我检索到了值

 <Report>
             <for-each select="$docSets" in="docSet">   
                <Key>{$docSet/@key}</Key>
                <Value>{$docSet//Entry/text()}</Value>
            </for-each>
   </Report>