Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Call Java methods from within the XSLT

  1. #1
    Join Date
    Aug 2012
    Posts
    1

    Default Call Java methods from within the XSLT

    Hi,

    I am fairly new to Pentaho. I got the task to get XSL Transformation going for quite complex XML/XSL. XSL is calling java methods defined in namespace / XPath - see http://www.edankert.com/transforms/x...voke-java.html.

    Anyone has any idea if this is possible in kettle and how can I specify the referenced class?

    The version I use is 4.3.0. Stable.

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Quote Originally Posted by veducko View Post
    Anyone has any idea if this is possible in kettle?
    Since there is an XSL Transform step, you should only be confined by restrictions imposed by SAXON9 and JAXP.

    Quote Originally Posted by veducko View Post
    and how can I specify the referenced class?
    In order to use the methods of some Java class as XPath extension functions, that class must be part of a namespace declaration.

    Code:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="java:java.util.Date">
      <xsl:output omit-xml-declaration="yes"/>
      <xsl:template match="/">
        <xsl:variable name="now" select="date:new()"/>
        <xsl:value-of select="date:toString($now)"/>
      </xsl:template>
    </xsl:stylesheet>
    So long, and thanks for all the fish.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.