on 05-12-2014 10:27 PM
XML content created from an SAP MII Transactions not displaying in an html table.
Here is a sample:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="Projects_Status.xslt"?>
<Rowsets CachedTime="" DateCreated="2014-05-12T10:31:48" EndDate="2014-05-12T10:31:48" StartDate="2014-05-12T09:31:48" Version="14.0 SP4 Patch 1 (Jan 8, 2014)">
<Rowset>
<Columns>
<Column Description="Jobs Name" MaxRange="100" MinRange="0" Name="Jobs" SQLDataType="12" SourceColumn="Jobs"/>
<Column Description="Job Status in percentage" MaxRange="100" MinRange="0" Name="Status" SQLDataType="4" SourceColumn="Status"/>
<Column Description="" MaxRange="100" MinRange="0" Name="PercentComplete" SQLDataType="4" SourceColumn="PercentComplete"/>
<Column Description="Date in ascending order" MaxRange="100" MinRange="0" Name="StartDate" SQLDataType="93" SourceColumn="StartDate"/>
<Column Description="" MaxRange="100" MinRange="0" Name="EndDate" SQLDataType="12" SourceColumn="EndDate"/>
</Columns>
<Row>
<Jobs>BOD - 9212</Jobs>
<Status>1</Status>
<PercentComplete>NA</PercentComplete>
<StartDate>2014-01-01T10:00:00</StartDate>
<EndDate>06/01/2014 10:00:00</EndDate>
</Row>
Notice in the second line above I hooked up the xml with an xslt style sheet - Projects_Status.xslt
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2></h2>
<table border="1">
<tr bgcolor="">
<th>Jobs</th>
<th>Status</th>
<th>PercentComplete</th>
<th>StartDate</th>
<th>EndDate</th>
</tr>
<xsl:for-each select="jobs">
<tr>
<td><xsl:value-of select="Jobs"/></td>
<td><xsl:value-of select="Status"/></td>
<td><xsl:value-of select="PercentComplete"/></td>
<td><xsl:value-of select="StartDate"/></td>
<td><xsl:value-of select="EndDate"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
But when I try to display the XML file in a browser I only get the heading
Hi Amr,
Try this;
<xsl:for-each select="//Row">
<tr>
<td><xsl:value-of select="Jobs"/></td>
<td><xsl:value-of select="Status"/></td>
<td><xsl:value-of select="PercentComplete"/></td>
<td><xsl:value-of select="StartDate"/></td>
<td><xsl:value-of select="EndDate"/></td>
</tr>
</xsl:for-each>
Thanks,
Shridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amr,
As Christian pointed out, it should be "Jobs" instead of "jobs" as it looks for the exact case sesitive word.
Secondly, when you write <xsl:for-each select="Jobs">, xslt is not able to position that particular column/field and that is why you should navigate the complete path as "/Rowsets/Rowset/Row" or "//Row"
Regards,
Anuj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Should <xsl:for-each select="jobs"> be <xsl:for-each select="Jobs"> ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.