I've seen this question asked many times but in slightly different ways. Looking at similar examples, there's something I'm still missing.
With the information below, I'm trying to do a XPath 1.0 select to get a set of unique customer account values from a XML with accounts. Executing a XSLT with templates, for-each's, and using Muenchian Grouping is not possible.
I have this XML:
<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
<Body xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
<MessageParts xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
<ReportArchive xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/ReportArchive">
<Report class="entity">
<_DocumentHash>d1fd3992e1d6cde8fd06512cea125792</_DocumentHash>
<ReportSection class="entity">
<Name>AddressBody</Name>
<Type>Body</Type>
<ReportSectionField class="entity">
<Name>CustTable_AccountNum</Name>
<Value>0000000001</Value>
</ReportSectionField>
</ReportSection>
<ReportSection class="entity">
<Name>AddressBody</Name>
<Type>Body</Type>
<ReportSectionField class="entity">
<Name>CustTable_AccountNum</Name>
<Value>0000000001</Value>
</ReportSectionField>
</ReportSection>
<ReportSection class="entity">
<Name>AddressBody</Name>
<Type>Body</Type>
<ReportSectionField class="entity">
<Name>CustTable_AccountNum</Name>
<Value>0000000002</Value>
</ReportSectionField>
</ReportSection>
<ReportSection class="entity">
<Name>AddressBody</Name>
<Type>Body</Type>
<ReportSectionField class="entity">
<Name>CustTable_AccountNum</Name>
<Value>0000000003</Value>
</ReportSectionField>
</ReportSection>
<ReportSection class="entity">
<Name>AddressBody</Name>
<Type>Body</Type>
<ReportSectionField class="entity">
<Name>CustTable_AccountNum</Name>
<Value>0000000004</Value>
</ReportSectionField>
</ReportSection>
<ReportSection class="entity">
<Name>AddressBody</Name>
<Type>Body</Type>
<ReportSectionField class="entity">
<Name>CustTable_AccountNum</Name>
<Value>0000000005</Value>
</ReportSectionField>
</ReportSection>
</Report>
</ReportArchive>
</MessageParts>
</Body>
</Envelope>
With this XPath:(//*[local-name()='ReportSectionField'][./*[local-name()='Name'] = 'CustTable_AccountNum']/*[local-name()='Value'])[not(. = following-sibling::*)]/text()
Using "()", my assumption was that the relative path select would create a node-set, and then the "not()" filter part would parse each sibling in the result set and return the unique values. When I use the "following-sibling" axis this fails, but the "following" axis works. I don't want to traverse the descendants, so "following" is not the axis I want to use. What am I missing and can someone help me visualize what's going on?
Some other things to note: - The XPath Compiler is .Net based (1.0) utilized by BizTalk (See this article for the reasons why: XPath and XSLT 2.0 for .NET?)