简体   繁体   中英

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. 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']">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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