BizTalk Mapping Tips 04: Using XPath Expressions Part 2

I previously talked about using XPath expressions in an orchestration in

BizTalk Mapping Tips 01: Using XPath Expressions. I have recently discovered that you do not

always want to wrap your XPath expression within a string() function.
You only want to use the string function when you want to retrieve the
text value of an XML node. You want to omit the string function if you
are trying to set the value of an XML node.

So, to get a value you want your XPath expression to look something
like this:

myVar = xpath(myMessage, "string(/*[local-name()='MyRootNode'])”);

To set a value, your XPath expression should look something like

myVar = xpath(myMessage, "/*[local-name()='MyRootNode']”);