Results 1 to 2 of 2

Thread: xml to html using xsl??

  1. #1
    Join Date
    Aug 2004

    xml to html using xsl??


    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


    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="Records.xsl"?>

    My xsl file Records.xsl :

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

    <xslutput method="html"/>

    <xsl:template match="/">
    <table border="1" cellSpacing="1" cellPadding="1">

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

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

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

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

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


  2. #2
    Join Date
    Dec 2002
    Calgary, Canada
    I am prety sure(since I am not an MS developer) when you use MS built in processor you do not put this statement
    <?xml-stylesheet type="text/xsl" href="Records.xsl"?>
    in the xml file, logic is htat you rprocessor will parse the xml using XSL file so there should be a command like this

    Dim myXPathDocument as XPathDocument = new XPathDocument ("xmlfile.xml"))
    Dim myXslTransform as XslTransform = new XslTransform()
    Dim reader as XmlReader = myXslTransform.Transform(myXPathDocument, nothing)

    I am pretty sure you can solve it from here on....


    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles