XSLT Mapping - Getting current date in XSLT version 1.0

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,
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 &gt; 11) and boolean($day &gt; 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

Similar Messages

  • XSLT 1.0 current date

    Hi,
    I had searched on SDN already and tried few codes without success.
    If somebody had already worked on current date function in XSLT mapping version 1.0, please share it.
    Thanks in advance,
    Venkat.
    PS: links I already referred.
    http://www.w3.org/TR/xpath-functions/#func-current-dateTime
    Error in Current Date in XSLT Mapping
    Re: XSLT Mapping - Getting current date in XSLT version 1.0
    Re: Current date in xslt mapping

    Hi,
    XSLT 1.0 does not provide any standard way to get the current date/time. You can call an extension function to do it (depends on your processor), or you can pass it to the stylesheet as the value of a parameter.
    current-date() and current-time(). For XSLT 1 you'll have to use the dates-and-times EXSLT extension package. Here's a usage example for XSLT 1:
    <xsl:stylesheet    xmlns:ex="http://exslt.org/dates-and-times"      extension-element-prefixes="ex">
            <xsl:value-of select="ex:date-time()"/>
    </xsl:stylesheet>
    Refer this for
    http://www.exslt.org/date/index.html

  • Problem with getting current date and time using oracle.jbo.domain.Date

    I`d like to get current date and time using oracle.jbo.domain.Date method getCurrentDate(), but it always return current date and 12:00:00. I also need to get the current time.

    I think you should use java.sql.Timestamp domain.
    (And set database type to TIME or DATETIME.)
    Jan

  • Get  current date and time

    hello.
    How can I get current date and time in JAVA?
    Thanks.

    Sorry, I mean:
    how can I get the value of DATE, MONTH, and YEAR of the
    current date?
         Date date = new Date();
         System.out.println(date);

  • How does BR get current date, user, and associate member with Attribute Dim

    I need use Business rules or Calc script to implement following functions:
    1. Get current date and the name of user who is running the BR and save the information to cube.
    I don't find any functions to get current date and users.
    Also, since text and date is store in relational database and essbase cube only stores the index, it looks that the value can't be changed or stored by using "==" directly, is there any function to change value of members with Text or Date types in BR/Calc script?
    2. End users select attribute value (via smart list) of products or projects(Sparse dimensions) in data form, run BR to update the association of these members with attribute dimension.
    I don't find any functions to change the attribute association in BR/Calc, is there any CDF (Custom Defined Function) that can do it?
    Thanks!

    Hi,
    For the date functionality, check out the post below.
    Re: Days behaviour between two dates
    As for the username, there is a little tricky way that requires an unused or a new dimension along with a smart list of user names. It's also possible to capture the user name from the cookies and pass it on to the form. The latter is possible through validatedata.js however requires hefty coding here and there.
    As for the attributes, it's not possible to update metadata through business rule. So no luck in there.
    Cheers,
    Alp

  • How to get current date for posting date

    hi,
    how to get current date for posting date ? any sample code ?
    Thanks

    Hi......
    Use
    Select getdate()
    for current date.......
    Regards,
    Rahul

  • To get current data block name

    Hi;
    I have 2 data blocks on my form and I want to get current data block name on my form. How can I do this???
    Thank you

    Like Rosario said, use the :SYSTEM.CURSOR_BLOCK.
    you can also use :SYSTEM.TRIGGER_BLOCK in triggers to find which block was responsible of the firing event of a trigger.
    Do not use :SYSTEM.CURRENT_% variables in Forms 9i and above, those are only there for compatibility reasons.
    You can also check the online help for more details on :SYSTEM.% system variables.
    Tony

  • Get current date style

    Hi
    How I can get current date adn time style?
    Thank you.

    Well, what do you need it for? If you just want to use the default locale when parsing/formatting a date, you just use DateFormat or SimpleDateFormat. You don't need to worry about the pattern.
    If you want to check what the pattern is with the default locale, you can try this:
    SimpleDateFormat sdf = (SimpleDateFormat)DateFormat.getInstance();
    System.out.println(sdf.toPattern());There is also a distinction between short, medium and long format, and you can get the time or date pattern only if you want. Check the API.

  • ADS : FP_TEST_00 Exception getting currently running XMLForm Module version

    Hi,
    We have installed ADS and Currently configuring it.
    The Reports FP_PDF_TEST_00 is working fine. But the reports FP_TEST_00 is hanging when i specify the Printer name and click on Print preview.
    The Following error message i got in the default trace file.
    1.5#001560DE2A38007F000000060000249E00044F4DBB40B6FF#1213095188495#com.adobe.AdobeDocumentServices#com.adobe/AdobeDocumentSer
    vices#com.adobe.AdobeDocumentServices#ADSUSER#136##lux09208_D10_13839050#Guest#6959e66036db11ddc504001560de2a38#SAPEngine_Appl
    ication_Thread[impl:3]_52##0#0#Error##Plain###Exception getting currently running XMLForm Module version.
    java.lang.IllegalStateException: No transaction
            at com.adobe.service.J2EEConnectionFactoryManagerPeerImpl.getConnection(J2EEConnectionFactoryManagerPeerImpl.java:70)
            at com.adobe.ads.proxy.ServiceLocator.getXmlfmFactory(Unknown Source)
            at com.adobe.EJB_XMLFormAgent.getFactory(Unknown Source)
            at com.adobe.EJB_XMLFormAgent.getVersion(Unknown Source)
            at com.adobe.AdobeDocumentServicesEJB.checkXmlfmVersion(Unknown Source)
            at com.adobe.AdobeDocumentServicesEJB.ejbCreate(Unknown Source)
            at sun.reflect.GeneratedMethodAccessor265.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.createObject(BeanFactory.java:113)
            at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.doResizeOneStepUp(ContainerPoolImpl.java:374)
            at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.ensureNotEmpty(ContainerPoolImpl.java:343)
            at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.pop(ContainerPoolImpl.java:291)
            at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.getActiveBean(BeanFactory.java:188)
            at com.sap.engine.services.ejb.session.stateless_sp5.StatelessContainerFP.getActiveBean(StatelessContainerFP.java:183)
            at com.adobe.AdobeDocumentServicesLocalLocalObjectImpl0.rpData(AdobeDocumentServicesLocalLocalObjectImpl0.java:87)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java
    :126)
            at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:157)
            at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:79)
            at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)
            at SoapServlet.doPost(SoapServlet.java:51)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    Also the FP_CHECK_DESTINATION_SERVICE report is also hanging with out any output.
    The RFC Connectivity ADS is working properly, The Users ADSUSEr and ADS_AGENt are configured properly. I am also able the test the Destination FP_ICF_DATA_<SID> in Visual Admin properly.
    The AdobeDocumentSErvices portal is also displaying the version number for me.
    Please let me know how this issue can be sorted out.

    Hello Subramanian,
    I am not sure if you have solved the problem of FP_CHECK_DESTINATION_SERVICE report. Using this report test you can check if the complete configuration of the destination service and the ICF service is correct. Since this report is not getting results in your case, I suspect there is problem in Destination Service or the ICF Service.
    Kindly do all the steps mentioned here.
    http://help.sap.com/saphelp_nw70/helpdata/en/44/63eefb818c311ee10000000a155369/content.htm
    Regards,
    Shubham

  • Current date in xslt mapping

    Hi,
    I've tried to get the current date in my xslt mapping.
    I've used the following xslt coding:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date">
    <xsl:template match="/">
    <xsl:variable name="now" select="current-date()"/>
    </xsl:template>
    </xsl:stylesheet>
    In stylus studio everything is OK and i retrieve the current date.
    When i import the xslt in the mapping tool and test the mapping i get the following error:
    javax.xml.transform.TransformerException: com.sap.engine.lib.xml.util.NestedException: Function with name 'current-date' not found in context library. at com.sap.engine.lib.jaxp.TransformerImpl.transform(TransformerImpl.java:251)
    While directly using the current date functionality within the message mapping everything is OK too.
    Does anyone know which date-functionality is used within the message mapping within the Integration Builder and/or wich mapping to be used in xslt for a working scenario?
    Thnx in advance!

    Ok thnx, these anwers where very helpfull for me to solve this problem.
    I've awarded points for all your answers.
    For anyone interested later on, I needed the date in my XSLT mapping in the following format ddMMMyy.
    Finnally I used the following xslt to achieve this:
         <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) + 1" />
              <xsl:variable name="year" select="substring(string(cal:get($now, 1)), 3, 2)" />
              <xsl:variable name="month">
                   <xsl:choose>
                        <xsl:when test="$month=1">Jan</xsl:when>
                        <xsl:when test="$month=2">Feb</xsl:when>
                        <xsl:when test="$month=3">Mar</xsl:when>
                        <xsl:when test="$month=4">Apr</xsl:when>
                        <xsl:when test="$month=5">May</xsl:when>
                        <xsl:when test="$month=6">Jun</xsl:when>
                        <xsl:when test="$month=7">Jul</xsl:when>
                        <xsl:when test="$month=8">Aug</xsl:when>
                        <xsl:when test="$month=9">Sep</xsl:when>
                        <xsl:when test="$month=10">Oct</xsl:when>
                        <xsl:when test="$month=11">Nov</xsl:when>
                        <xsl:when test="$month=12">Dec</xsl:when>
                        <xsl:otherwise>INVALID MONTH</xsl:otherwise>
                   </xsl:choose>
              </xsl:variable>
              <xsl:choose>
                   <xsl:when test="$day &lt; 10">
                        <xsl:value-of select="concat(concat(concat('0',$day), $month), $year)"/>
                   </xsl:when>
                   <xsl:otherwise>
                        <xsl:value-of select="concat(concat($day, $month), $year)"/>
                   </xsl:otherwise>
              </xsl:choose>
         </xsl:template>

  • Current Date in XSLT 1.0 Mapping

    Hi All,
    Very Good Morning...
    I have one issue my XSLT mapping, One filed is required current date and time.But in XSLT 1.0 there is no standard date function. But XSLT 2.0 version is aviable.
    I am using the XSLT1.0 version.i saw in SDN some threads are related to this issue. XSLT supported for Java extensions.
    Upto now i am n't working with JAVA mapping. How i can create a JAVA extension and how i can import to Integration Respoistery....
    Kindly give me suggestion about this issue.
    Thank you very much.
    Sateesh

    Dear Sateesh,
    Declare xlst variables at start of xsl program like below
                             <xsl:output method="xml" indent="yes"/>
         <xsl:variable name="today_formatted" select="java:java.text.SimpleDateFormat.new('yyyyMMdd')"/>
         <xsl:variable name="time_formatted" select="java:java.text.SimpleDateFormat.new('HHmmss')"/>
          and use them in xsl mapping
    <xsl:value-of select="substring(concat(java:format($today_formatted, $date),$blanks),1,8)"/>
    <xsl:value-of select="substring(concat(java:format($time_formatted, $date),$blanks),1,6)"/>
    thanks,
    madhu

  • Error in Current Date in XSLT Mapping

    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.

    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

  • File TO File-Using XSLT mapping (for Beginners) --- Error in XSLT

    Hi,
    I am following this wiki (TO File-Using XSLT mapping (for Beginners))
    https://wiki.sdn.sap.com/wiki/display/XI/FileTOFile-UsingXSLTmapping%28forBeginners%29
    When creating  Xslt from the MapForce, when I click on the XSLT Tab I am getting the following error
    http://www.flickr.com/photo_zoom.gne?id=1216715484&size=o
    How to correct this error ?.....
    Thanks
    srini
    Message was edited by:
            srinivas

    Hello,
    The XSD you are using is from Data Type and you are using it for mapping.
    Instead export XSD for Message Type and also pass the XML schema for source that will solve the issue and your XSLT will be generated.
    Regards,

  • How do get current date/time in GMT?

    Is there any way to get the current date and time in GMT (while my current locale is not GMT)?
    In Java I can do this:
    long currenttime = System.currentTimeMillis();
    java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy/MM/dd HH:mm:ss z");
    df.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
    java.util.Date date = new java.util.Date();
    date.setTime(currenttime);But, there seems to be no way to do the equivalent in BPEL in SOA Suite.
    I did some research and I think I could appy the XPath 2.0 function adjust-dateTime-to-timezone() to the current time, but that function is not available.
    Using SOA SUite 11.1.13.0.
    THanks.

    have you tried changing the stylesheet version in the xsl to 2.0 and then try the function again ?
    by changing this version it was possible to use newer functions, which weren't available in the designer

  • Can i get current date in XSL FO customized file with Apex 3.0??

    Hi Oracle staff,
    i have a problem with the insert of current date in customized layout's XSL FO file..
    I have just tried to insert current-time() function and js scripts....but nothing.....PDF,Word or HTML output file that's printed by Bi Publisher displays an error that says:"Content file not supported or damaged".
    Why???is Bi Publisher a XSLT processor that supports currrent date functions????.
    and if not.....how can i install a new processor in substitution of Bi Publisher/Apache FOP???
    Regards
    Emanuel

    Yes, you can click the title bar of any document (the down arrow) to access the current file name:

Maybe you are looking for

  • IPhone 5 screen dimming

    My iPhone 5 screen keeps going completely dark and I have to struggle to see the icons and navigate to brightness and fix it , but when I get to the brightness seething it is where I left it ( not on lowest setting ) also have have a issue with my so

  • Error in Adding the sample Portlet Provider

    I got the congratulation !! after testing the JSP "http://ltree1:80/servlets/sample, but I'm getting the following error when I try to add the SampleWebProvider The error is : Error: An error occurred when attempting to call the providers register fu

  • Pause button requires 3 clicks to work

    Greetings, I'm using Captivate 3 and have noticed that on some projects (not all of them) the Pause button takes three clicks before it will Pause. The first time it changes the icon to Play, but doesn't stop the playhead or audio. The next click (on

  • Laptop Crash with Adobe Connect.

    I can successfully log in, but when I select my classroom as a host the classroom opens but when I try to do anything at all I have a total system lock up/hang up. I then have to manually shut down and start again. This happens all the time in both C

  • Icons on iPhone 4S won't rearrange

    I can't get the icons to permanently rearrange on my iphone 4s.  I move them but when I hit the home screen to save the phone goes to the "Apple" symbol and restarts.