Actions
Support #5617
closedfn:format-dateTime does not work as expected
Start date:
2022-07-27
Due date:
% Done:
0%
Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Java
Description
Hello, I am trying to use fn:format-dateTime to parse the date from date time format to another, but I am getting weird errors
following is the sample xslt I am using
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/2005/xpath-functions"
xmlns:func="http://ingka.ikea.com/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:int="http://ikea.com/FUI/stockreport"
xmlns:date="http://www.w3.org/2005/xpath-functions"
version="3.0">
<xsl:output method="text" indent="yes" omit-xml-declaration="yes" />
<xsl:strip-space elements="*"/>
<xsl:param name="MessageReference" />
<xsl:template match="/">
<xsl:variable name="transformed-xml">
<xsl:call-template name="body" />
<xsl:copy-of select="/map"/>
</xsl:variable>
<!-- Added replace startment to print n/a as is, issue https://saxonica.plan.io/issues/5225-->
<xsl:value-of select="xml-to-json($transformed-xml, map { 'indent' : true() })"/>
</xsl:template>
<xsl:template name="body" >
<map>
<map key="MsgHeader">
<xsl:call-template name="MsgHeader"/>
</map>
</map>
</xsl:template>
<xsl:template name="MsgHeader" >
<string key="MsgNames"><xsl:value-of select="parse-dateTime('05/30/2018 09:00:00','MM/dd/yyyy HH:MMMX')"/></string>
<string key="MsgVersNo">1.0</string>
<string key="MsgDateTime"><xsl:value-of select="format-dateTime(current-dateTime(),'[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z00:00]')"/></string>
</xsl:template>
</xsl:stylesheet>
goal is to convert sample date time from 05/30/2018 09:00:00 to the standard format like "2018-05-30T09:00:00.000+02:00
So wanted to parse this date time, get into standard date time format and then finally using format-dateTime to get the required date time format.
but while using the above xslt, I keep getting error
Stylesheet compilation failed with 1 error(s): Error 1 at line 35:0 : Cannot find a 2-argument function named Q{http://www.w3.org/2005/xpath-functions}parse-dateTime(). External function calls have been disabled
Please register to edit this issue
Actions