MirTOSface xsl
Exemple d'xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<meta http-equiv="refresh" content="10; URL={/MirTOS/@call_me}?token={/MirTOS/@token}"/>
<title>MirTOS Panel</title>
<style>
</style>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</head>
<body bgcolor="#CE6211" text="white">
<font color="white" face="arial">
<h2>MirTOS Panel </h2>
<I style="font-size:10px;"><xsl:value-of select="/MirTOS/@token"/> - <xsl:value-of select="/MirTOS/@faceVersion"/></I>
<BR/>
<I style="font-size:10px;"><xsl:value-of select="/MirTOS/@configMsg"/> </I>
<BR/>
<xsl:for-each select="MirTOS/MirTOS_Devices/MirTOS_Device">
<xsl:variable name="ageColor">
<xsl:choose>
<xsl:when test="LatestTS/@Age < 61">
<xsl:text>#006622;</xsl:text>
</xsl:when>
<xsl:when test="LatestTS/@Age > 60 and LatestTS/@Age < 301">
<xsl:text>#006644;</xsl:text>
</xsl:when>
<xsl:when test="LatestTS/@Age > 300 and LatestTS/@Age < 3600">
<xsl:text>#e0aa07;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>#660a00;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="ageWithUnit">
<xsl:choose>
<xsl:when test="LatestTS/@Age < 60">
<xsl:value-of select="format-number(LatestTS/@Age,'###,###,##0 s')"/>
</xsl:when>
<xsl:when test="LatestTS/@Age > 59 and LatestTS/@Age < 3600">
<xsl:value-of select="format-number(LatestTS/@Age div 60,'###,###,##0.00 m')"/>
</xsl:when>
<xsl:when test="LatestTS/@Age > 3599 ">
<xsl:value-of select="format-number(LatestTS/@Age div 3600,'###,###,##0.00 h')"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>{LatestTS/@Age} s</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!--<table style="background-color:#006622;">--> <!--width:100%;-->
<table style="width:300px;background-color:{$ageColor}">
<tbody>
<tr style="color: white;">
<td><xsl:value-of select="Description"/></td>
<td align="right"><xsl:value-of select="LastRelay"/></td>
</tr>
<tr style="color: white;">
<td style="font-size:10px;"><xsl:value-of select="DeviceName"/> / <xsl:value-of select="LatestTS"/> (<xsl:value-of select="$ageWithUnit"/>) <xsl:value-of select="Version"/></td>
<td align="right" style="font-size:10px;"><xsl:value-of select="IP"/></td>
</tr>
<xsl:for-each select="MirTOS_Vars/MirTOS_Var">
<tr style="color: white;">
<td style="font-size:10px;"><xsl:value-of select="VarName"/>=<xsl:value-of select="VarValue"/></td>
<td style="font-size:10px;" align="right"><xsl:value-of select="TimeStamp/@Age"/> sec</td>
</tr>
</xsl:for-each>
<xsl:for-each select="MirTOS_Pubs/MirTOS_Pub">
<tr>
<td colspan="2">
<!--<button style="width:300;height:30px" onclick="location.href='MirTOSface?device={../../DeviceName}&mode=MQTT&cmd=CALL&fct={Fct}'"><xsl:value-of select="FctCaption"/></button>
-->
<!-- if token ... -->
<button style="width:100%;height:30px" onclick="location.href='MirTOSface?device={../../DeviceName}&token={/MirTOS/@token}&mode=MQTT&cmd=CALL&fct={Fct}'"><xsl:value-of select="FctCaption"/></button>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
<BR/>
</xsl:for-each>
</font>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Créé avec HelpNDoc Personal Edition: Générateur complet d'aides multi-formats