I am working on developing XSL and I need to know the NOT IN equivalent in XPATH. I present XML and XSL in a simple format that everyone can understand.
<?xml-stylesheet type="text/xsl" href="XSL.xsl"?>
<Message>
<Customers>
<Customer pin="06067">1</Customer>
<Customer pin="06068">2</Customer>
<Customer pin="06069">3</Customer>
<Customer pin="06070">4</Customer>
<Customer pin="06072">5</Customer>
</Customers>
<Addresses>
<Address pin1="06067">A</Address>
<Address pin1="06068">B</Address>
<Address pin1="06069">C</Address>
</Addresses>
</Message>
XSL
<xsl:template match="/Message">
<html>
<body>
<h4>Existing Customers</h4>
<table>
<xsl:apply-templates select="//Customers/Customer[@pin = //Addresses/Address/@pin1]"></xsl:apply-templates>
</table>
<h4>New Customers</h4>
<table>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="Customer" name="Customer">
<xsl:variable name="pin" select="./@pin"></xsl:variable>
<tr>
<td>
<xsl:value-of select="."/>
<xsl:text> is in </xsl:text>
<xsl:value-of select="//Addresses/Address[@pin1=$pin]"/>
</td>
</tr>
</xsl:template>
In the XSLT above in the comments area, I need to map and display clients whose addresses do not exist in the node addresses / addresses.
Help find an XPath expression that matches those who are NOT in the Node Address Set. (Any alternative may also help)
source
share