I'm trying the following XPath:
//*[local-name()='SN102'][1]
Using XPathTester, I saved my scenario http://www.xpathtester.com/xpath/94ee37e08960247a7bf0619d38c52bee
Not every HL1Loop has a SN102.
Otherwise, I could this:
//*[local-name()='HLLoop1'][1]//*[local-name()='SN102']
I have simplified the sample data down to the following:
<ns0:X12_00401_856 xmlns:ns0="http://schemas.microsoft.com/BizTalk/EDI/X12/2006">
<ns0:HLLoop1>
<ns0:SN1>
<SN102>1</SN102>
<SN103>EA</SN103>
<SN108>AC</SN108>
</ns0:SN1>
</ns0:HLLoop1>
<ns0:HLLoop1>
<ns0:SN1>
<SN102>2</SN102>
<SN103>EA</SN103>
<SN108>AC</SN108>
</ns0:SN1>
</ns0:HLLoop1>
</ns0:X12_00401_856>
The result is coming back with all nodes, not just the first one:
<?xml version="1.0" encoding="UTF-8"?>
<result>
<SN102>1</SN102>
<SN102>2</SN102>
</result>
How do I select the first node only. Seems simply, and I'm sure I've done it before, but not working today.
I have a "Vendor Simulator" program that is building fake 856 data to send back, and I want to increase the first quantity only to force some error handling logic.