-
-
Save Jozefson/f0d975accf0662e9b2f1 to your computer and use it in GitHub Desktop.
vr2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:ms="urn:schemas-microsoft-com:xslt" | |
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> | |
<xsl:output method="html" indent="yes"/> | |
<xsl:param name="file" select="document('data.xml')"/> | |
<xsl:template match="/"> | |
<xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text> | |
<html> | |
<head> | |
<title>Temperature Data</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
<script src="http://code.highcharts.com/highcharts.js"></script> | |
<meta charset="utf-8"></meta> | |
<style> | |
body { | |
background-color: #99CCFF; | |
width: 80%; | |
text-align: center; | |
margin: 0 auto; | |
} | |
.content { | |
display: inline-block; | |
} | |
table { | |
display: inline-block; | |
} | |
table td { | |
padding: 7px; | |
margin: 0 auto; | |
} | |
.temp { | |
float: left; | |
} | |
.sens { | |
font-size:small; | |
} | |
.switch { | |
float: left; | |
margin-left: 80px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="content"> | |
<div class="temp"> | |
<xsl:for-each select="root/sensors"> | |
<xsl:if test="@active = 'true'"> | |
<xsl:for-each select="sensor"> | |
<h2> | |
Location: <xsl:value-of select="@location"/> | |
</h2> | |
<table> | |
<tr> | |
<th>Time</th> | |
<th>Value</th> | |
</tr> | |
<xsl:for-each select="reading"> | |
<tr> | |
<td> | |
<xsl:value-of select="ms:format-date(substring(@timestamp,1,10), 'yyyy MMM dd')"/> | |
<xsl:value-of select="ms:format-time(substring(@timestamp,1,19), ' Kell: hh:mm:ss')"/> | |
</td> | |
<td> | |
<xsl:value-of select="concat(substring(@value,1,4), @unit)"/> | |
</td> | |
</tr> | |
</xsl:for-each> | |
</table> | |
</xsl:for-each> | |
</xsl:if> | |
</xsl:for-each> | |
</div> | |
<div class="switch"> | |
<xsl:for-each select="root/switches"> | |
<xsl:if test="@active = 'true'"> | |
<xsl:for-each select="switch"> | |
<h2> | |
Location: <xsl:value-of select="@location"/> | |
</h2> | |
<h3 class="sens"> | |
Switch: <xsl:value-of select="@switches"/> | |
</h3> | |
<table> | |
<tr> | |
<th>Time</th> | |
<th>Value</th> | |
</tr> | |
<xsl:for-each select="log"> | |
<tr> | |
<td> | |
<xsl:value-of select="ms:format-date(substring(@timestamp,1,10), 'yyyy MMM dd')"/> | |
<xsl:value-of select="ms:format-time(substring(@timestamp,1,19), ' Kell: hh:mm:ss')"/> | |
</td> | |
<td> | |
<xsl:value-of select="@value"/> | |
</td> | |
</tr> | |
</xsl:for-each> | |
</table> | |
</xsl:for-each> | |
</xsl:if> | |
</xsl:for-each> | |
</div> | |
</div> | |
</body> | |
</html> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment