on 10-16-2009 9:39 AM
Hi,
I want to fetch the system date and compare it with another date, say 06.04.2010.
How can I do this in XSLT 1.0?
Thanks & Regards,
Aditi Naik
Hi Jude,
Thank you for the quick response. Can you please tell me how I can use syst-datum in an xslt code to fetch the actual date value?
I need to use this XSLT mapping in XI. I had created a mapping in XSLT 2.0 with the date check as follows:
<xsl:when test="boolean(//*[local-name() = 'IRenvelope']/node() and boolean(year-from-date(current-date()) = 2009) and boolean(month-from-date(current-date()) > 11) and boolean(day-from-date(current-date()) > 05))">
However, the currentdate() function is not supported by XI. Hence I need to replace code given above by using statements that
are supported in XSLT 1.0
Thanks & Regards,
Aditi Naik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aditi,
(As far as I know) There is no standard way in XSLT 1.0 to take the system date .. You cah use XSLT with java enhancement to get the system date. check this
http://help.sap.com/saphelp_nwpi71/helpdata/EN/55/7ef3003fc411d6b1f700508b5d5211/frameset.htm
Also for comparing two date strings you can use something like
<xsl:if test="number(translate(date1, '-', '')) > number(translate(date2,'-', ''))">
Check if this works
Regards
Suraj
Hi,
I tried using the following code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cal="java:java.util.GregorianCalendar">
<xsl:output method="xml"/>
<xsl:template name="currentDate" xmlns:cal="java:java.util.GregorianCalendar">
<xsl:variable name="now" select="cal:getInstance()"/>
<xsl:variable name="day" select="cal:get($now, 5)"/>
<xsl:variable name="month" select="cal:get($now, 2)"/>
<xsl:variable name="year" select="substring(string(cal:get($now, 1)), 3, 2)"/>
</xsl:template>
..........
.........
..............
<Body>
<xsl:choose>
<xsl:when test="boolean(//*[local-name() = 'IRenvelope']/node()) and boolean($year = 2009) and boolean($month > 11) and boolean($day > 05))">
................
..........
.........
</xsl:when>
..............
..........
...........
</xsl:choose>
</Body>
However, when I try to run this mapping I get the error "Invalid XPath Expression" in Altova.
Can you please tell me exactly what is wrong with this code and how I can get around this?
Thanks & Regards,
Aditi Naik
Hi,
I also tried using the following code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="java:java.util.GregorianCalendar">
<xsl:output method="xml"/>
<xsl:variable name="now" select="date:get()"/>
<xsl:variable name="day" select="date:get($now, 5)"/>
<xsl:variable name="month" select="date:get($now, 2) + 1"/>
<xsl:variable name="year" select=" date:get($now, 1) "/>
<xsl:variable name="day1" select="$day"/>
<xsl:variable name="month1" select="$month"/>
<xsl:variable name="year1" select="$year"/>
...........
.........
.........
</xsl:stylesheet>
I get the error that function date:get() is not in correct namespace.
I'm using Altova XML Spy and wrote the code above by referring to the format given on the Altova site
http://www.altova.com/manual/AltovaXML/index.html?xextjava.htm
Could you please tell me how I can proceed further?
Thanks & Regards,
Aditi Naik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
You can use syst-datum in the table SYST.
Once you fetch the value you can compare it easily
Regards,
Jude
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.