Two handy references for BizTalk XSLT:
Substring in XSLT Value-Of XPATH
The first example is fairly easy, I just needed to get the date/time without the timezone modifier, in other words to convert this: 2016-01-29T00:00:00-08:00
to this: 2016-01-29T00:00:00.
The reason was that our web service was only coded to handle the date without the timezone. It used an Orcacle date/time conversion like this:
eValue = "TO_DATE('" + eValue.Replace("T", " ").Replace(".0000000", "") + "','YYYY-MM-DD HH24:MI:SS')";
XPath “Where” clause when using complex namespaces
Take a look at the data below. I needed to map the EventDate associated with DateType=PLN to D02, and the EventDate associated with DataType=FCT to D03.
Most of the examples on the internet show you how to do this when you don’t have namespaces involved. But when you do have namespaces, the trick is to use nested queries in your XPATH. In the sample below, you can see that the text in yellow is complete inside the other xpath brackets.
Using [local-name()=’xxx”] is like saying find me the element whose name matches ‘xxx’.
Once the where has been matched, the “xsl:value-of” statement begins with ./ to go up one level, then to find the EventDate (that is on the same level as DateType) to put in the output field.