Trying to display XML in HTML

wxdqz

New Member
This is what I need:

User opens HTML file---->data from XML file is displayed in order in HTML file

This is my problem:

User opens HTML file----> Only the heading "current log" and "tstamp" and "entry" are displayed

I took the HTML and SXL from <!-- m --><a class="postlink" href="http://www.w3schools.com/xsl/xsl_client.asp">http://www.w3schools.com/xsl/xsl_client.asp</a><!-- m -->

HTML:
<html>
<body>
<script type="text/javascript">// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("CurrentLog.xml")// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("CurrentLog.xsl")// Transform
document.write(xml.transformNode(xsl))
</script>
</body>
</html>

XML:
<?xml version="1.0" standalone="yes" ?>
- <IncrepDataset xmlns="http://tempuri.org/IncrepDataset.xsd">
- <Control>
<Control_ID>0</Control_ID>
<Name>DocViewer</Name>
<Filename>docviewer.dll</Filename>
<Icon>doc</Icon>
<IncrepLoadable>true</IncrepLoadable>
<Version>4.0.0.28546</Version>
<TStamp>2006-11-06T18:00:09.4160070-06:00</TStamp>
</Control>
- <Control>
<Control_ID>-1</Control_ID>
<Name>RIDS</Name>
<Filename>ridswrapper.dll</Filename>
<Icon>tool</Icon>
<IncrepLoadable>true</IncrepLoadable>
<Version>4.0.0.28559</Version>
<TStamp>2006-11-06T18:00:32.8518090-06:00</TStamp>
</Control>
- <Control>
<Control_ID>-2</Control_ID>
<Name>Explosives</Name>
<Filename>atfwrapper.dll</Filename>
<Icon>tool_bomb</Icon>
<IncrepLoadable>true</IncrepLoadable>
<Version>4.0.0.28559</Version>
<TStamp>2006-11-06T18:01:01.2952610-06:00</TStamp>
</Control>
- <Control>
<Control_ID>-3</Control_ID>
<Name>ChecklistViewer.Bomb Response</Name>
<Filename>checklistwrapper.dll</Filename>
<Icon>tool_checklist</Icon>
<IncrepLoadable>false</IncrepLoadable>
<Version>4.0.0.28559</Version>
<TStamp>2006-11-06T18:01:21.5461976-06:00</TStamp>
</Control>
- <DataType>
<Datatype_id>1</Datatype_id>
<name>String</name>
<description />
</DataType>
- <IncidentLog>
<IncidentLog_ID>-10</IncidentLog_ID>
<TStamp>2006-11-06T18:01:26.7541536-06:00</TStamp>
<Entry>- 'COMMENCE IED SOP/ERG ACTIONS. GATHER ALL INFO.' checked</Entry>
<AddedByUser>false</AddedByUser>
<submission_id>0</submission_id>
<Priority>Low</Priority>
<Control_ID>-3</Control_ID>
</IncidentLog>
- <IncidentLog>
<IncidentLog_ID>-11</IncidentLog_ID>
<TStamp>2006-11-06T18:01:26.8142454-06:00</TStamp>
<Entry>- 'SET INITIAL EXCLUSION AREA.' checked</Entry>
<AddedByUser>false</AddedByUser>
<submission_id>0</submission_id>
<Priority>Low</Priority>
<Control_ID>-3</Control_ID>
</IncidentLog>
- <IncidentLog>
<IncidentLog_ID>-12</IncidentLog_ID>
<TStamp>2006-11-06T18:01:26.8943678-06:00</TStamp>
<Entry>- 'MAKE ALL NOTIFICATIONS.' checked</Entry>
<AddedByUser>false</AddedByUser>
<submission_id>0</submission_id>
<Priority>Low</Priority>
<Control_ID>-3</Control_ID>
</IncidentLog>
- <IncidentLog>
<IncidentLog_ID>-13</IncidentLog_ID>
<TStamp>2006-11-06T18:01:26.9644749-06:00</TStamp>
<Entry>- 'IDENTIFY ON-SCENE COMMAND (OSC)/ COMMAND POST (CP) LOCATION.' checked</Entry>
<AddedByUser>false</AddedByUser>
<submission_id>0</submission_id>
<Priority>Low</Priority>
<Control_ID>-3</Control_ID>
</IncidentLog>
- <IncidentLog>
<IncidentLog_ID>-14</IncidentLog_ID>
<TStamp>2006-11-06T18:01:38.6222841-06:00</TStamp>
<Entry>Incident Summary selected</Entry>
<AddedByUser>false</AddedByUser>
<submission_id>0</submission_id>
<Priority>Low</Priority>
</IncidentLog>
</IncrepDataset>

XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with XML Spy v2006 (<!-- m --><a class="postlink" href="http://www.altova.com">http://www.altova.com</a><!-- m -->) -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>

<xsl:template match="/">
<html>
<body>
<h2>Current Log</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">TStamp</th>
<th align="left">Entry</th>
</tr>
<xsl:for-each select="tstamp/entry">
<tr>
<td><xsl:value-of select="TStamp"/></td>
<td><xsl:value-of select="Entry"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

I have two other versions of the HTML file that don't require XSL but they only half work.
One displays everything I want but not in the right order the other displays in the right order
but only displays the first TStamp and Entry.
 
Back
Top