xml to html using xsl??

admin

Administrator
Staff member
Hi,

I am trying to get xml output from a server and display it in the form of a table.
I am loading the xml by calling a script on a server -->

Dim xmlDoc As New System.Xml.XmlDocument

xmlDoc.Load("http://111.111.111.111/summit.asp?axrows=3&Lastname=davies")

I was getting the data back and putting it in a dataset then a datagrid, but this
is to restrictive. I am now trying to get the xml in and display it using a xsl.


Below I list my xsl file and also the reference to it that is contained in my xml .
I am not sure how I call these files. When I do my Load should this happen automatically?
I gues not. I am new to .net and xml. I need to know what I am leaving
out to get it to print the table.

Any help will be most appreciated.


This is the first two lines of my xml:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href=http://www.webdeveloper.com/forum/archive/index.php/"Records.xsl"?>



My xsl file Records.xsl :

<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/TR/REC-html40">

<xsl:output method="html"/>

<xsl:template match="/">
<HTML>
<HEAD>
<TITLE> XSLT In .NET </TITLE>
</HEAD>
<BODY>
<table border="1" cellSpacing="1" cellPadding="1">
<center>

<xsl:for-each select="//Record">
<xsl:element name="tr">

<xsl:element name="td">
<xsl:value-of select="Key" />
</xsl:element>

<xsl:element name="td">
<xsl:value-of select="Sex" />
</xsl:element>

<xsl:element name="td">
<xsl:attribute name="align">center</xsl:attribute>
<xsl:value-of select="DateOfBirth" />
</xsl:element>

<xsl:element name="td">
<xsl:attribute name="align">center</xsl:attribute>
<xsl:value-of select="Description" />
</xsl:element>

</xsl:element>
</xsl:if>
</xsl:for-each>
</center>
</table>
</BODY>
</HTML>
</xsl:stylesheet>
:confused: :confused: :confused: :confused: :confused: :confused:
 
Back
Top