This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,829 Users
  • 2,269,775 Discussions
  • 7,916,823 Comments

Discussions

Referencing external XSLT libraries in Java 1.7

3026380
3026380 Member Posts: 1
edited Jan 24, 2016 2:34PM in Java Enterprise Edition

An oracle jdk 1.7 project uses XSL transformation, and in it, some exsl.org functions. So the namespace is included in the xsl file like this:

xmlns:date="http://exslt.org/dates-and-times" version="1.0"

Then, the XSL is trying to use one of them exsl functions like this:

<xsl:variable name="convDt">

    <xsl:value-of select="date:add(concat(substring($tmpDate,1,10),'T',substring($tmpDate,12,8)), 'PT2H')"/>

  </xsl:variable>

When we run xsltproc on input xml and this xsl , it works fine. But we have written JAXP module, for this transformation running on JDK 1.7.

javax.xml.transform.TransformerFactory transFact = javax.xml.transform.TransformerFactory

                .newInstance();

        javax.xml.transform.Transformer trans = transFact

                .newTransformer(xsltSource);

       

        trans.transform(xmlSource, result);

From the logs, we see it just does not work

XML-22015: (Error) Function 'add' not found.

I wodner what will be the correct namespace? Are these libraries stored somewhere and these namespaces serve as keys for some mappings anyway?