开发者

Get a nodeset of all local-names with xpath

开发者 https://www.devze.com 2023-02-10 03:06 出处:网络
With XPath 1.0, Instead of <xsl:for-each select=\"*\"> <xsl:variable name=\"varName\" select=\"local-name()\" />

With XPath 1.0, Instead of

<xsl:for-each select="*">
  <xsl:variable name="varName" select="local-name()" />
  <!-- Do stuff with $varName -->
</xsl:for-each>

I really want to do something like

<xsl:for-each select="*/local-name()">
  <!-- Do stuff with . ('.' as in the current value) -->
</xsl:for-each>

or

<xsl:for-开发者_StackOverflow中文版each select="local-name(*)">
  <!-- Do stuff with . ('.' as in the current value) -->
</xsl:for-each>

Is there any way to do this?


A node set contains nodes. It doesn't contain names. Therefore your question contains the contradiction that proves it can't be done.

The XPath 2.0 data model makes it perfectly possible to manage a collection of names as a value. But XPath 1.0 only allows node-sets, or singleton strings, booleans, and numbers.

0

精彩评论

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