on 01-16-2009 3:32 PM
Hi Experts,
I am having a problem in Dispaying the current Date and Time ( or System Date and Time ) .As per my Project Requirements I need do XSLT mapping
My XSLT Mapping Looks like
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://XYZ.eu.ABC.com">
<xsl:template match="/">
<a:A2A>
<a:PNo>
<xsl:value-of select="Path/Path/PNO"/>
</a:PNo>
<a:Rev>
<xsl:value-of select="Path/Path/REVISION"/>
</a:Rev>
<a:Current Date>
<xsl:value-of select= ""/>
</a:Current Date>
<a:Current Time>
<xsl:value-of select= ""/>
</a:Current Time>
</xsl:template>
</xsl:stylesheet>
Can any one please let me is there is any function to dispaly the Current Date and time.
There is a standard date/time function available to use for date and time. Ideally, you should use the standard functions, if you have one.
For XSLT :
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="xml"
indent="yes"
omit-xml-declaration="yes"/>
<xsl:template match="/aaa">
<xxx>
<xsl:value-of select="current-dateTime()"/>
</xxx>
<yyy>
<xsl:value-of select="current-date()"/>
</yyy>
<zzz>
<xsl:value-of select="current-time()"/>
</zzz>
</xsl:template>
</xsl:stylesheet>
link : http://www.zvon.org/xxl/XSL-Ref/Tutorials/Date-Time/dt1.html
Thanks,
Pooja Pandey
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:datetime="http://exslt.org/dates-and-times"
exclude-result-prefixes="datetime">
<xsl:template match="/">
<currtime>
<xsl:value-of select="datetime:dateTime()" />
</currtime>
</xsl:template>
</xsl:stylesheet>
Hi ..
I just tried executing both the maps.. Both of them excutes well in both XMLSpy and Stylus Studio .. But having below problems in Executing in PI
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/aaa">
<xxx>
<xsl:value-of select="current-dateTime()"/>
</xxx>
</xsl:template>
</xsl:stylesheet>
Then I got the error
javax.xml.transform.TransformerException: com.sap.engine.lib.xml.util.NestedException: Function with name 'current-dateTime' not found in context library.
with
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:datetime="http://exslt.org/dates-and-times"
exclude-result-prefixes="datetime">
<xsl:template match="/">
<currtime>
<xsl:value-of select="datetime:dateTime()" />
</currtime>
</xsl:template>
</xsl:stylesheet>
I have got
Unable to find resource http://exslt/org/dates-and-times.class (http://NAMESPACE Name) in the following software component versions: 0fe18820-410a-11dd-979b-dc8591374305
Hi All,
Thank you very much for your answers.
I have tried all the options in displaying current date and time in XI ( Using XSLT mapping )... and found one easy way to dispay Current Date and Time using Runtime Functions
For more informations regarding Runtime functions in XSLT
http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
/message/435521#435521 [original link is broken]
Finally XSLT map looks like
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://XYZ.eu.ABC.com">
<xsl:param name="TimeSent" />
<xsl:template match="/">
<a:A2A>
<a:PNo>
<xsl:value-of select="Path/Path/PNO"/>
</a:PNo>
<a:Rev>
<xsl:value-of select="Path/Path/REVISION"/>
</a:Rev>
<a:Current DateTime>
<xsl:value-of select= "$TimeSent"/>
</a:Current DateTime>
</xsl:template>
</xsl:stylesheet>
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.