0 Replies Latest reply on Jul 16, 2011 6:29 PM by 875949

    Calling Java Android code from XSLT

      I am trying to get an XSLT stylesheet to work that invokes Java code at certain points during execution (used to parse RDFa). You can find a very simple example of such code below:

      <?xml version="1.0" encoding="UTF-8"?>
      xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" version="1.0"
      xmlns ="http://www.w3.org/1999/XSL/Transform"
      exclude-result-prefixes="java" >

      <xsl:template match="/">
      <value-of select="java:android.xslt_test.XSLTTest.testing()"/>

      Although this XSLT calls the specified method for a Java desktop application, it doesn't do anything in an Android application (no methods are called and the transformer simply returns the original document). After I configured the Transformer instance with a custom ErrorListener subclass instance (via aTransformer.setErrorListener()), I get a NullPointerException (packaged as a TransformerException) when the above XSLT code is parsed. This error does not occur for "normal" XSLT sheets (these are parsed correctly on Android).

      Any ideas on why this doesn't work? Do I need to use another prefix / namespace for Android applications? I've spent quite some time looking online for a solution, but couldn't find any..