XSLT with XPATH expressions

Tags: #<Tag:0x00007f616e477670>


I am able to successfully transform an xml using pure xslt. Skipping the whole file, following line will work fine and place the value of $txt in the output:
<xsl:value-of select="$txt"/>

But when I try to add even a simplest function, it throws an exception in xslt formatting:
<xsl:value-of select="fn:lower-case($txt)"/>

(I also add the following to the stylesheet: xmlns:fn="http://www.w3.org/2005/xpath-functions")

Such example works fine in an online xslt compiler. The real problem I am trying to solve is that the xml I parse contains the date of the most recent sensor reading and I want to convert this into an age of the value. I am able to do so, but nothing from xslt functions works in openhab.

Any hints?


This is the exception I am getting. At least the resolution of the function seems to be fine, but there is the problem with the argument. This is the same if I pass a variable or a string directly.

javax.xml.transform.TransformerConfigurationException: The first argument to the non-static Java function 'lowerCase' is not a valid object reference.
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:1020) [?:?]

I dug a bit more and it looks like XPATH 2.0 functions align with XSLT 2.0 and XSLT binding supports default processor, which is 1.0.
There are advices that XSLT 2.0 can be realized with saxon library. Is there any reason why this library can’t be added to the smarhome? I think I will ask this question in the eclipse smarthome forum.