获取XML中的属性值

Dal*_*las 133 xml xslt xpath attributes

如何使用xslt在以下xml中获取attribute1(blah)的值:

<name attribute1="blah" attribute2="blahblah">
</name>
Run Code Online (Sandbox Code Playgroud)

Jam*_*lak 256

这更像是一个xpath问题,但是像这样,假设上下文是父元素:

<xsl:value-of select="name/@attribute1" />
Run Code Online (Sandbox Code Playgroud)

  • @Arty - 我认为你要找的只是 xsl:value-of select="./@attributename" (6认同)
  • 同样,这将是一个xpath问题; (3认同)