5 replies Latest Post - ‏2014-04-02T22:38:04Z by Leandro_Vasquez
6772 Posts

Pinned topic Supported EXSLT functions with corresponding XSLT/XPath 2.0 Functions

‏2008-06-05T20:34:02Z |

This may be useful for people grappling with XSLT 2.0 and XPath 2.0. Here are the EXSLT functions already available in DataPower and the XSLT/XPath 2.0 functions that correspond (if available):

EXSLT XPath/XSLT 2.0 Function
date:add op:add-dayTimeDuration-to-dateTime OR op:add-dayTimeDuration-to-date
date:add-duration op:add-dayTimeDurations
str:concat fn:string
date:date fn:current-date
date:date-time fn:current-dateTime
date:day-abbreviation N/A
date:day-in-month fn:day-from-date OR fn:day-from-dateTime
date:day-in-week N/A
date:day-in-year N/A
date:day-name N/A
date:day-of-week-in-month N/A
str:decode-uri N/A
date:difference op:subtract-dateTimes OR op:subtract-dates
set:difference op:except
set:distinct fn:distinct-values
date:duration N/A
str:encode-uri fn:encode-for-uri
set:has-same-node N/A
date:hour-in-day fn:hours-from-dateTime
set:intersection op:intersection
set:leading N/A
date:leap-year N/A
regExp:match xsl:analyze-string
date:minute-in-hour fn:minutes-from-dateTime
date:month-abbreviation N/A
date:month-in-year fn:month-from-dateTime
date:month-name N/A
common:object-type N/A
str:padding N/A
regExp:replace fn:replace
date:second-in-minute fn:seconds-from-dateTime
date:seconds N/A
str:split fn:tokenize
regExp:test fn:matches
date:time fn:current-time
str:tokenize fn:tokenize
set:trailing N/A
date:week-in-month N/A
date:week-in-year N/A
date:year fn:year-from-dateTime

Message was edited by: Matt_McLarty
Updated on 2011-09-26T08:44:10Z at 2011-09-26T08:44:10Z by HermannSW
  • HermannSW
    4135 Posts

    Re: Supported EXSLT functions with corresponding XSLT/XPath 2.0 Functions

    ‏2011-09-26T08:44:10Z  in response to SystemAdmin
    Please see this posting on far bigger EXSLT support for newer DataPower firmware releases (no comparison with XSLT/XPath 2.0):

    • mdindagur
      33 Posts

      Re: Supported EXSLT functions with corresponding XSLT/XPath 2.0 Functions

      ‏2013-05-02T13:55:20Z  in response to HermannSW


      I am looking to set up a <wsse:Security> header to outgoing requests from within the enterprise. I need to set  created date and expires attributes to my header, apart from setting PasswordDigest and Nonce. I got help from another thread in the forum to set the header attributes. However, I dont know how to set up an expiration of 1500 sec after the time message is created, as is required by the service provider.


      I tried to access the above mentioned thread for EXSLT capabilities in datapower, to see if there are any built in functions, which i can use. The thread doesnt seem to exist any longer. Can some one point me in the right direction to achieve this? As of now, I get the fpollowing error datapower logs after the transformation.

      11:43:48 multistep error 136539633 request 0x80c00009 wsgw (*criteriaWSP): request *criteriaWSP_requestRule #2 xform: 'Transforming PIPE with store:///sign-wssec.xsl results stored in dpvar_1' failed: store:///set-wssec-sign-param.xsl:1414: xsl:message terminate=yes value=''
      11:43:48 xslt error 136539633 request 0x80c00010 wsgw (*criteriaWSP): Execution of 'store:///sign-wssec.xsl' aborted: store:///set-wssec-sign-param.xsl:1414: xsl:message terminate=yes value=''
      11:43:48 xsltmsg error 136539633 request 0x83c00013 wsgw (*criteriaWSP): Error: Timestamp expiration, Expires is 2013-5-1 NaN:NaN:NaN

      The relevant part of my stylesheet is as follows:

      <xsl:variable name="duration" select="60" />
      <xsl:variable name="currentTime" select="dp:time-value()" />
       <xsl:variable name="expiresWhen" select="date:date(date:add($currentTime,$duration))" />
                          <xsl:variable name="wsseCreated"
                              select="concat(date:year($now), '-',
                                       date:month-in-year($now), '-',
                                       date:day-in-month($now),' ',
                                       date:second-in-minute($now))" />
                  <xsl:variable name="wsseExpires"
                              select="concat(date:year($expiresWhen), '-',
                                       date:month-in-year($expiresWhen), '-',
                                       date:day-in-month($expiresWhen),' ',
                                       date:second-in-minute($expiresWhen))" />

      Appreciate a quick response in this regard.



      • HermannSW
        4135 Posts

        Re: Supported EXSLT functions with corresponding XSLT/XPath 2.0 Functions

        ‏2013-05-02T14:51:24Z  in response to mdindagur

        Hi Mahesh,

        date:add() needs a date-time and a duration.

        dp:time-value() gives you the milliseconds since January 1st 1970, not a date.

        date:date-time() without arguments gives you the current date and time as date-time.

        A duration of 1500 seconds is specified by "PT1500S" (which is 25 minutes, or "PT25M").

        Here you can see how to do what you want by xpath++ tool:

        $ echo "<foobar/>" | xpath++ "date:date-time()" -
        $ echo "<foobar/>" | xpath++ "date:add(date:date-time(),'PT1500S')" -

        Note the different timezones -- date:date-time() reports in US EST time of DataPower box, date:add() in Zulu time.

        Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

        Updated on 2013-05-02T14:53:36Z at 2013-05-02T14:53:36Z by HermannSW
        • mdindagur
          33 Posts

          Re: Supported EXSLT functions with corresponding XSLT/XPath 2.0 Functions

          ‏2013-05-02T15:22:12Z  in response to HermannSW


          Thank you so much for the quick response. By this you mean, we have to convert back the wsseExxpires in zulu time back to our time. Also, I noticed that date:date-time() is showing  CST(our timezone) in our data power box as against EST you mentioned. Are there any more elegant means of achieving this?

          This brings me to another question, which may already have been covered elsewhere. We need to introduce user name token, signing and encryption for the request going out of our enterprise. Initially, when we tried the signing option available in datapower to use wssec envelope, we didnt know of a way to introduce user name/passworddigest and nonce. Hence, the approach we want to follow is

          1. use a transform to introduce user name token with password digest and nonce, along with message expiration time
          2. use sign action to sign the message
          3. use encrypt action to encrypt
          4. invoke the secure service.

          Do you see any issue in this approach? We are trying this for a bunch of services, with the common requirement, and would like your opinion on this.

          Appreciate your time so much.



      • Leandro_Vasquez
        1 Post

        Re: Supported EXSLT functions with corresponding XSLT/XPath 2.0 Functions

        ‏2014-04-02T22:38:04Z  in response to mdindagur

        Buenas tardes, de pronto ya está resuelto su problema, sin embargo quería dejar este aporte, el cual se desarrolló basado en: " [Consultado en Línea el 2 de Abril de 2014]"


        <xsl:variable name="timestamp" select="date:date-time()"/> 

        <xsl:variable name="ZuluTimeCre" select="date:add($timestamp,'PT0H')"/>

        <xsl:variable name="ZuluTimeExp" select="date:add($timestamp,'PT5M')"/> 

        <xsl:variable name="ms" select="substring(dp:time-value(),11,3)"/> 

        <xsl:variable name="wsseCreated"><xsl:value-of select="concat(substring($ZuluTimeCre,1,19),'.',$ms,'Z')"/></xsl:variable>

        <xsl:variable name="wsseExpires"><xsl:value-of select="concat(substring($ZuluTimeExp,1,19),'.',$ms,'Z')"/></xsl:variable>



        wsseCreated = 2014-04-02T17:30:51.589Z

        wsseExpires = 2014-04-02T17:35:51.589Z


        Updated on 2014-04-02T22:40:10Z at 2014-04-02T22:40:10Z by Leandro_Vasquez