0

WebSphere Application server, using service transformer utilizing WAS implementation com.ibm.xtq.xslt.jaxp.compiler.TransformerFactoryImpl, on XSLT 1.0.

I am unable find a way - works fine with Xalan or Saxon but IBM implementation lacks functionality. Here is my code working fine with other implementations except IBM's:

 <xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:date="http://exslt.org/dates-and-times"
extension-element-prefixes="date xs">

<xsl:output method="xml" indent="no"/>
<xsl:param name="sentDateTime"/>
<xsl:variable name="duration" select="'P1D'"/>
<xsl:template match="/">
    <soap:Envelope>
        <soap:Header>

     …..
            <u:Expires><xsl:value-of select="xs:dateTime($sentDateTime) + xs:dayTimeDuration($duration)"/></u:Expires>
                </u:Timestamp>    
     …..

I get this error on IBM translator:

javax.xml.transform.TransformerException: java.lang.RuntimeException: [ERR 0343] The XSLT processor was unable to resolve a reference to the Java method 'dateTime'. at com.ibm.xtq.xslt.jaxp.TransformerImpl.transform(Unknown Source)

justanu
  • 81
  • 4
  • Note that if you're using the IBM DataPower XSLT processor, you can also use the EXSLT `date:add()` extension function: http://exslt.org/date/functions/add/index.html – michael.hor257k Jul 07 '20 at 22:00
  • The app is on WebSphere Java application server (WAS) not on DataPower. It looks like IBM impl is not fully compatible to the specs. – justanu Jul 08 '20 at 09:45
  • Not sure which "specs" you mean. Neither EXSLT nor adding dayTimeDuration to dateTime are part of XSLT 1.0. Your code will also NOT work with Xalan - contrary to what you said. It works with Saxon, because Saxon (now) supports XSLT 2.0. In any case you can (and should) consult the documentation of your processor to see which extensions, if any, it supports. – michael.hor257k Jul 08 '20 at 11:20
  • Thanks michael.hor257k . I could set XSLT 2.0 compiling fine but complaining about xs:dateTime and xs:dayTimeDuration. IFAIK, it supports XSLT2.0 but limited in functions. Same XSLT works just fine on XMLSpy (which I assumed use Xalan, hence my comment). I ended up using a laborious math calculation. – justanu Jul 09 '20 at 12:06
  • https://stackoverflow.com/questions/23566734/date-operations-on-xsl-1-0 – justanu Jul 09 '20 at 12:14
  • You can easily tell which processor is being used and what version of XSLT it supports: https://stackoverflow.com/questions/25244370/how-can-i-check-which-xslt-processor-is-being-used-in-solr/25245033#25245033 – michael.hor257k Jul 09 '20 at 12:36

0 Answers0