Hi... New to XML
Creating a sort of Service dashboard...
My XML Structure is
and my XLS is...
Unfortunately I'm getting an error
when I try to view the data.
I can't figure out where I have gone wrong.... I did have <status> set as green, amber, red and tried xls:when test="status = 'green'"> but got similar errors.
Any help appreciated.
I've not failed! Just found 100 ways that don't work...yet!
Creating a sort of Service dashboard...
My XML Structure is
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- Edited by XMLSpy® -->
<service_data>
<service>
<service_name>Outlook</service_name>
<data_centre>SDC01</data_centre>
<status>3</status>
<details></details>
<timeofincident></timeofincident>
</service>
<service>
<service_name>Internet</service_name>
<data_centre>SDC01</data_centre>
<status>1</status>
<details>Proxy Server Fault</details>
<timeofincident>11:03</timeofincident>
</service>
</service_data>
and my XLS is...
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:template match="/">
<html>
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
<div style="background-color:orange;color:black;padding:4px">SERVICES</div>
<xsl:for-each select="service_data/service">
<xsl:sort select="service_name"/>
<xsl:choose>
<xls:when test="status > 2">
<div style="background-color:green;color:white;padding:4px">
<span style="font-weight:bold">
<xsl:value-of select="service_name" />
</span>
</div>
</xls:when>
<xls:when test="status > 1">
<div style="background-color:orange;color:black;padding:4px">
<span style="font-weight:bold">
<xsl:value-of select="service_name" />
</span>
</div>
</xls:when>
<xls:otherwise>
<div style="background-color:red;color:white;padding:4px">
<span style="font-weight:bold">
<xsl:value-of select="service_name" />
</span>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<xsl:value-of select="details" />
<span style="font-style:italic">
(time of incident
<xsl:value-of select="timeofincident" />
)
</span>
</div>
</xls:otherwise>
</xls:choose>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Unfortunately I'm getting an error
Code:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Reference to undeclared namespace prefix: 'xls'. Error processing resource 'file://irf00307/4974974$/test.xsl'. Line 11, P...
<xls:when test="status > 2">
when I try to view the data.
I can't figure out where I have gone wrong.... I did have <status> set as green, amber, red and tried xls:when test="status = 'green'"> but got similar errors.
Any help appreciated.
I've not failed! Just found 100 ways that don't work...yet!