Question

I'm having a problem with xpath query. I have a schema with two DateTime fields and I need the Max Datetime from all the records in the schema.

this is my Xpath:

xPath_a = "max(/libary/DateTime1)";

any suggestion about how to make it work in Xpath?

Was it helpful?

Solution

Unfortunately, the version of XPath and Xslt supported in .Net still 1.0 so that's what BizTalk uses.

XPath 1.0 does not have a max() function.

Since the syntax you posted suggests an Orchestration, the most practical option is a helper class that takes message as a XmlDocument parameter.

This thread has an example of hot to use an XPathDocument and an XmlDocument: http://social.msdn.microsoft.com/Forums/en-US/e6addfe7-c94f-495b-9e79-35c48844b33f/select-max-value-from-xml-file?forum=xmlandnetfx

This thread provides examples of using XDocument and LINQ: Get max attribute value from XML using LINQ

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top