I have the following xpath expressions...
//ns:response/ns:return/legs/startDate (Value 01/01/2011) //ns:response/ns:return/legs/startTime (Value 12:13)
I need to format and concat these values into something like this
Is this possible to do using xpath functions? An example would be appreciated.
The date format in the input data is dd/mm/yyyy.
As by @Michael Key suggestion (+1), three
substring() and one
concat() is all what you need. Check at this XSLT example using the XPath you are searching for (use of variables to make expression readable):
<xsl:template match="/"> <xsl:variable name="sD" select="'01/01/2011'"/> <xsl:variable name="sT" select="'12:13'"/> <xsl:value-of select="concat( substring($sD,7),'-', substring($sD,4,2),'-', substring($sD,1,2),'T', $sT,':00')"/> </xsl:template>
It would help to know whether your 01/01/2011 is d/m/y or m/d/y. Either way, it's just a question of calling substring() three times to extract the parts of the data, and then concat() to build up the result.
Look at XPath 1.0 functions: