This is my response message:
<?xml version="1.0" encoding="UTF-16"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<QueryMXCPISResponse baseLanguage="EN"
creationDateTime="2014-11-25T11:56:09+01:00"
maximoVersion="7 5 20130829-1209 V7510--1"
messageID="1416912970550686680" rsCount="3" rsStart="0"
rsTotal="3" transLanguage="EN"
xmlns="http://www.ibm.com/maximo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MXCPISSet>
<CPIS>
<AK>D</AK>
<CPISID>630124</CPISID>
<ORGID>01</ORGID>
<S1>0</S1>
<S2>0</S2>
<S3>0</S3>
<S4>0</S4>
<S5>0</S5>
<S6>1</S6>
<SHIFT>3</SHIFT>
<SHIFTDATE>2014-09-30T00:00:00+02:00</SHIFTDATE>
<SITEID>0030</SITEID>
<STATUS>NEW</STATUS>
<TEAM>C</TEAM>
<WP>LC11</WP>
<ASSET>
<ASSETNUM>LC11</ASSETNUM>
<LOCATION>FACILITY-1</LOCATION>
<SITEID>0030</SITEID>
</ASSET>
</CPIS>
<CPIS>
<AK>D</AK>
<CPISID>630121</CPISID>
<ORGID>01</ORGID>
<S1>0</S1>
<S2>0</S2>
<S3>1</S3>
<S4>0</S4>
<S5>0</S5>
<S6>1</S6>
<SHIFT>1</SHIFT>
<SHIFTDATE>2014-09-30T00:00:00+02:00</SHIFTDATE>
<SITEID>0030</SITEID>
<STATUS>CHECKED</STATUS>
<TEAM>B</TEAM>
<WP>LC11</WP>
<ASSET>
<ASSETNUM>LC11</ASSETNUM>
<LOCATION>FACILITY-1</LOCATION>
<SITEID>0030</SITEID>
</ASSET>
</CPIS>
<CPIS>
<AK>D</AK>
<CPISID>630122</CPISID>
<ORGID>01</ORGID>
<S1>1</S1>
<S2>1</S2>
<S3>0</S3>
<S4>0</S4>
<S5>0</S5>
<S6>1</S6>
<SHIFT>2</SHIFT>
<SHIFTDATE>2014-09-30T00:00:00+02:00</SHIFTDATE>
<SITEID>0030</SITEID>
<STATUS>APPLIED</STATUS>
<TEAM>B</TEAM>
<WP>LC11</WP>
<ASSET>
<ASSETNUM>LC11</ASSETNUM>
<LOCATION>FACILITY-1</LOCATION>
<SITEID>0030</SITEID>
</ASSET>
</CPIS>
</MXCPISSet>
</QueryMXCPISResponse>
</soapenv:Body>
And this my xsl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="MXCPISSet">
<html>
<body>
<table>
<tbody>
<tr>
<th>WP</th>
<th>Site</th>
<th>Shift</th>
</tr>
<xsl:for-each select="CPIS">
<tr>
<td><xsl:value-of select="WP"/></td>
<td><xsl:value-of select="ASSET/SITEID"/></td>
<td><xsl:value-of select="SHIFT"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
This is the result:
D 630124 01 0 0 0 0 0 1 3 2014-09-30T00:00:00+02:00 0030 NEW C LC11 LC11 FACILITY-1 0030 D 630121 01 0 0 1 0 0 1 1 2014-09-30T00:00:00+02:00 0030 CHECKED B LC11 LC11 FACILITY-1 0030 D 630122 01 1 1 0 0 0 1 2 2014-09-30T00:00:00+02:00 0030 APPLIED B LC11 LC11 FACILITY-1 0030
If I delete xmlns="http://www.ibm.com/maximo" from response message i get the correct output
WP Site Shift
LC11 0030 3
LC11 0030 1
LC11 0030 2
What is wrong in my XSL file that I don't get the HTML output?
The elements
QueryMXCPISResponse
,MXCPISSet
, etc are in the namespacexmlns="http://www.ibm.com/maximo"
. Without the namespace, the processor doesn't match any elements, and instead of applying your stylesheet, the default processing rules are applied. You'll need to accommodate this namespace in your template, as follows (note thexmlns
and alias,m
for maximo):Other info:
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
<xsl:output method="html"/>
in the stylesheet.xsl:for-each