Android: How to use xxx:node-set() for XSLT transform in Android

1.1k Views Asked by At

I have an XSL file which is successful in transforming my XML on the desktop browser. In that XSLT I am making use of the EXLT node-set() function.
On trying to transform the same XML file using the same XSL file on Android it throws me an error stating "Error in XPATH expression" and points me to the line where I am calling the node-set() function.
Any ideas on how to use xxx:node-set() in Android?

2

There are 2 best solutions below

1
On

Android use LibXML2, so there are a hasExsltSupport() method. If enabled, use as showed by http://www.exslt.org/exsl/index.html

0
On

Android uses Xalan. I have not managed to get Android Studio to build with exslt extensions declared, but the xalan namespace functions build after downloading namespace declarations. Unfortunately, it still throws errors:

javax.xml.transform.TransformerException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object org.apache.xalan.extensions.ExtensionsTable.extFunction(org.apache.xpath.functions.FuncExtFunction, java.util.Vector, org.apache.xalan.extensions.ExpressionContext)' on a null object reference

This seems like a bug because the context is supposed to come from the processor, xsl only supplies the param/variable.