[xiph-commits] r19110 - icecast/trunk/icecast/web
dm8tbr at svn.xiph.org
dm8tbr at svn.xiph.org
Sun Mar 9 05:27:58 PDT 2014
Author: dm8tbr
Date: 2014-03-09 05:27:58 -0700 (Sun, 09 Mar 2014)
New Revision: 19110
Added:
icecast/trunk/icecast/web/status-json.xsl
Log:
Initial JSON status transform.
Output roughly limited to data also visible through status.xsl.
Added: icecast/trunk/icecast/web/status-json.xsl
===================================================================
--- icecast/trunk/icecast/web/status-json.xsl (rev 0)
+++ icecast/trunk/icecast/web/status-json.xsl 2014-03-09 12:27:58 UTC (rev 19110)
@@ -0,0 +1,29 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:import href="xml2json.xslt.fail"/>
+<xsl:output indent="no" omit-xml-declaration="yes" method="text" encoding="UTF-8" media-type="text/javascript"/>
+<xsl:strip-space elements="*"/>
+
+<!-- override imported transform variable to enable output -->
+<xsl:variable name="output">true</xsl:variable>
+
+<!-- hide certain nodes from all sources -->
+<xsl:template match="icestats/source/source_ip" />
+<xsl:template match="icestats/source/slow_listeners" />
+<xsl:template match="icestats/source/public" />
+<xsl:template match="icestats/source/*[contains(name(), 'total_bytes')]" />
+<xsl:template match="icestats/source/user_agent" >
+ <!-- user_agent is most of the time the last node in a mount,
+ if we just delete it, then we will malform the output,
+ so special handling applies. -->
+ <xsl:if test="following-sibling::*"></xsl:if>
+ <xsl:if test="not(following-sibling::*)">"dummy":null}</xsl:if>
+</xsl:template>
+
+<!-- hide certain global nodes -->
+<xsl:template match="icestats/sources" />
+<xsl:template match="icestats/clients" />
+<xsl:template match="icestats/stats" />
+<xsl:template match="icestats/listeners" />
+<xsl:template match="node()[contains(name(), 'connections')]" />
+
+</xsl:stylesheet>
More information about the commits
mailing list