2

We have a preference for using TPE for BAM tracking since it can be deployed independently of our orchestrations.

However, at one point in our process, we need to track a message payload property which has a 1:N relationship with the Root XML Element of the message.

Despite the 1:N relationship, extracting just the first value of this property will be sufficient for our tracking needs.

As usual, if we attempt to track this, then the following XLANG message is logged:

AmbiguousXPathException - The result set for the XPath expression ... 
contains more than a single node

We have tried to modify the BTT XPath directly to select just the first instance of this Property

I've tried

'XPath="//*[local-name()='Property' and namespace-uri()='{URI}' ...]/[1]'

but then get the error "Expression must evaluate to a node-set"

and more simply

'//Property[1]' and '//Property[position() = 1]'

Give no error, but this doesn't pull out my property either.

Lastly, can anyone explain the difference between the XPath and SomXPath in the BTT file?

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
StuartLC
  • 104,537
  • 17
  • 209
  • 285

1 Answers1

3

It is like shooting in the dark without any XML document provided, but you may try this:

(//*[local-name()='Property' and namespace-uri()='{URI}' ...])[1]

It is a FAQ that //x[1] does't select one node, while (//x)[1] does.

The first means: every element named x, that is the first child of its parent.

The second means: the first element x in the document.

Dimitre Novatchev
  • 240,661
  • 26
  • 293
  • 431
  • 1
    Thank you Dimitre! Works perfectly. XPath="(//*[local-name()='PONumber' and namespace-uri() ='http://www.domain.com/shared/Atlas/BusinessProcess/PurchaseOrder/SPort/2010/03'])[1]" I've left the SomXPath exactly as TPE created it (i.e. no [1]) Regards Stuart – StuartLC Jun 28 '10 at 10:22