How to display table with attribute values  
Author Message
David N.4117





PostPosted: XML and the .NET Framework, How to display table with attribute values Top

Hi All,

I am trying to display a table report using XML and XSLT, but could not get it to work. Here are my files:

XML File:

< xml-stylesheet type="text/xslt" href="..\testlog.xslt" >

<LogMessages>
<LogMessage EntryNo="000000000001" EventNo="30000" User="System" Interface="" ProcessId="608" BytesTransferred="0" BytesReadWrite="0" Time="20061026202051825">
<![CDATA[

Program starts....
]]>
</LogMessage>
<LogMessage EntryNo="000000000003" EventNo="30001" User="System" Interface="" ProcessId="608" BytesTransferred="0" BytesReadWrite="0" Time="20061026202051825">
<![CDATA[
Configuration loaded:
* Keypair: MD5: ec:27:2a:30:e2:5d:4b:88:b2:0e:71:2e:e3:fd:33:11 Babble: xebaf-lepuf-lapab-hefuk-vomif-dymem-ciniz-putys-zytut-secul-duxix*
]]>
</LogMessage>
<LogMessage EntryNo="000000000004" EventNo="30240" User="System" Interface="" ProcessId="608" BytesTransferred="0" BytesReadWrite="0" Time="20061026202051845">
<![CDATA[
Listening on interface 0.0.0.0:22
]]>
</LogMessage>
<LogMessage EntryNo="000000000005" EventNo="30005" User="System" Interface="" ProcessId="608" BytesTransferred="0" BytesReadWrite="0" Time="20061026202051845">
<![CDATA[
Service started, executable file name:myTest.exe
]]>
</LogMessage>

</LogMessages>

And here is my XSLT file (Table block):

<TABLE width="430">

<TR>

<TH>Event No.</TH>

<TH>Process Id</TH>

<TH>User Name</TH>

<TH>Ip Address</TH>

<TH>Log Time</TH>

</TR>

<xslt:for-each select="LogMessages/LogMessage">

<TR>

<TD Width="200"><xslt:value-of select /></TD>

<TD Width="200"><xslt:value-of select /></TD>

<TD Width="200"><xslt:value-of select /></TD>

<TD Width="200"><xslt:value-of select /></TD>

<TD Width="200"><xslt:value-of select /></TD>

</TR>

</xslt:for-each>

</TABLE>

When I double click on the XML file, instead of displaying the table, it only displays the XML file. Yes, it returns me an error if I delete the xslt file, which means that it does look for the ref="" on the XML file. However, some how, it does not translate properly.

Can anyone tell me what is wrong with my code in the xslt table definition. Also, how to I display the data in the CDATA section on a last column in the table

Thanks in advance.




.NET Development23  
 
 
Dimitre_Novatchev - MSFT





PostPosted: XML and the .NET Framework, How to display table with attribute values Top

Doesn't seem like an XSLT file to me -- where is the top xsl:stylesheet element Where are the xsl:template elements
 
 
David N.





PostPosted: XML and the .NET Framework, How to display table with attribute values Top

I don't want to copy and paste the entire file. But, any way, here is the entire file:

< xml version="1.0" encoding="UTF-16" >

<xslt:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xslt:output method="html"/>

<xslt:template match="/">

<html>

<body bgcolor="#DDDDDD" style="background-color: #EDECE9">

<P> <H2>Reflection for Security Server Report</H2> </P>

<P> <H3>Logging Report</H3> </P>

<!-- Group ERROR is logged when the process completes successfully-->

<TABLE width="430">

<TR>

<TH>Event No.</TH>

<TH>Process Id</TH>

<TH>User Name</TH>

<TH>Ip Address</TH>

<TH>Log Time</TH>

<TH>Log Message</TH>

</TR>

<xslt:for-each select="/LogMessage">

<TR>

<TD Width="200"><xslt:value-of select /></TD>

<TD Width="200"><xslt:value-of select /></TD>

<TD Width="200"><xslt:value-of select /></TD>

<TD Width="200"><xslt:value-of select /></TD>

<TD Width="200"><xslt:value-of select /></TD>

<TD Width="500"><xslt:value-of select="." /></TD>

</TR>

</xslt:for-each>

</TABLE>

</body>

</html>

</xslt:template>

</xslt:stylesheet>



 
 
David N.





PostPosted: XML and the .NET Framework, How to display table with attribute values Top

Never mind. I found the problem. It was this line on the XML file

< xml-stylesheet type="text/xslt" href="..\testlog.xslt" >

it should be:

< xml-stylesheet type="text/xsl" href="..\testlog.xslt" >

Thanks all