开发者

selecting current element name in XSLT

I need to output the element name which is being returned after applying the xpath expression for example

&l开发者_JS百科t;xsl:for-each select="//element">
      <xsl:value-of select="**{elementname}**"></xsl:value-of>
      <xsl:text>:</xsl:text>
      <xsl:value-of select="current()"/>
      <xsl:value-of />
</xsl:for-each>

How can i replace {elementname} to some xpath so that I can get the element name instead of current value


<xsl:value-of select="name()" />

Side note: Avoid the // shorthand unless you absolutely have no other possibility. It seems quick and easy, but it isn't - it is computationally very expensive, and 90% of the time you don't need it.

Write a canonical replacement XPath expression whenever you can. Even something as generic as /*/*/node runs much faster than //node.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜