<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html> <head> <this-is section="expressions" page="except" subpage=""/> <!-- Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Set difference and intersection</title> <meta name="coverage" content="Worldwide"/> <meta name="copyright" content="Copyright Saxonica Ltd"/> <meta name="title" content="Saxonica: XSLT and XQuery Processing: Set difference and intersection"/> <meta name="robots" content="noindex,nofollow"/> <link rel="stylesheet" href="../saxondocs.css" type="text/css"/> </head> <body class="main"> <h1>Set difference and intersection</h1> <p>These operators are new in XPath 2.0.</p> <p>The expression <code>E1 except E2</code> selects all nodes that are in <code>E1</code> unless they are also in <code>E2</code>. Both expressions must return sequences of nodes. The results are returned in document order. For example, <code>@* except @note</code> returns all attributes except the <code>note</code> attribute.</p> <p>The expression <code>E1 intersect E2</code> selects all nodes that are in both <code>E1</code> and <code>E2</code>. Both expressions must return sequences of nodes. The results are returned in document order. For example, <code>preceding::fig intersect ancestor::chapter//fig</code> returns all preceding <code>fig</code> elements within the current chapter.</p> <table width="100%"> <tr> <td> <p align="right"><a class="nav" href="union.xml">Next</a></p> </td> </tr> </table> </body> </html>