简体   繁体   English

从for-each循环XSLT中排除一个节点

[英]Excluding one node from a for-each loop XSLT

I have a for-each loop, and I want to exclude an element based on an attribute value. 我有一个for-each循环,并且我想基于属性值排除一个元素。 I came across this 我遇到了这个

<xsl:for-each select="*[not(self::element-to-ignore)]">

But I am unsure how to apply it to the following context. 但是我不确定如何将其应用于以下情况。

<table>
  <xsl:for-each select="document('document.xml')//area">
    <xsl:sort select="@description"/>
      <tr>
        <td><xsl:value-of select="@description"/></td>
      </tr>
  </xsl:for-each>
</table>

I want to exclude one node from my iterated list 我想从迭代列表中排除一个节点

Is there a more correct way to achieve this? 有没有更正确的方法来实现这一目标?

I guess you mean 我想你是说

<xsl:for-each select="*[local-name() != 'element-to-ignore']">

or if you really mean "attribute value" 或者,如果您的意思是“属性值”

<xsl:for-each select="*[@attribute != 'value-to-ignore']">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM