Hi everyone,
I am trying to write a simple item which displays a status received from an XML returned from a URL. My item looks like this:
String is_ohmHour "OhmHour Active? [%s]" {http="<[api_url:10000:XSLT(ohmConnect.xsl)]"}
My sitemap
sitemap demo label="Home" {
Frame label="Energy" {
Text item=is_ohmHour
}
}
My XSL code looks like this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="no" method="text" encoding="UTF-8" omit-xml-declaration="yes" />
<xsl:template match="text()"></xsl:template>
<xsl:template match="ohmhour/active">
<xsl:choose>
<xsl:when test="self::node()[node()='True']">Yes</xsl:when>
<xsl:when test="self::node()[node()='False']">No</xsl:when>
<xsl:otherwise><xsl:value-of select="@service"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
The XML returned is extremely simple. It looks like this:
<ohmhour>
<address>1234 Normal St</address>
<active>False</active>
</ohmhour>
I tested the XSL outside of OpenHab and it returns the desired result. But when I run this on my system my dashboard appears not to be implementing the transformation. I enabled XSLT Transforms in the Paper UI.
Any help would be greatly appreciated. Thanks!
Donny