cancel
Showing results for 
Search instead for 
Did you mean: 

Current TimeStamp in XSLT

Former Member
0 Kudos

Hi Folks,

I got a requirement to have the current timestamp in XSLT mapping.

The Code i have developed is working fine at the Altova XML SPY but it is failing when i test in PI

<Time>

<xsl:variable name="time">

<xsl:value-of select="current-time()"/>

</xsl:variable>

<xsl:value-of select="concat(substring($time,1,2),substring($time,4,2),substring($time,7,2))"/>

</Time>

I have provided the code above, could you please kindly mention the changes that help me to get the result in SAP PI.

The Error am getting in PI "current-time() not found in the context library"

Thanks & Regards,

Sekhar

Accepted Solutions (0)

Answers (6)

Answers (6)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Do something like this.. you might have to customize for the timestamp as per  your need...

<?xml version="1.0" encoding="UTF-8"?>  

<xsl:stylesheet version="1.0"   

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   

xmlns:java="http://xml.apache.org/xslt/java" 

exclude-result-prefixes="java">  

<xsl:value-of select="java:format(java:java.text.SimpleDateFormat.new('yyyy.MM.dd'), java:java.util.Date.new())" />    

</xsl:stylesheet>

iaki_vila
Active Contributor
0 Kudos

Hi Shekar,

Why don't use a second mapping after the XSL mapping?. In a message mapping you can do easily and it will be easier to mantain and understand.

Regards.

udo_martens
Active Contributor
0 Kudos

Hi,

you can use the runtime constant $TimeSent, first declare it as parameter:

<xsl:param name="TimeSent" />

/Udo

Former Member
0 Kudos

have you seen below thread :

http://scn.sap.com/message/6872799

MichalKrawczyk
Active Contributor
0 Kudos

hi,

in PI we cannot use xslt 2.0 so the data function does not work

more info:

http://scn.sap.com/thread/2006718

Regards,

Michal Krawczyk

Former Member
0 Kudos

XSLT 3.0 is already out. Why still no support for XSLT 2.0?

Will SAP stick on graphic mapping and Java mapping and not plan to go on with XSLT mapping any more?