Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Generate a new XML doc

Reply
Thread Tools

Generate a new XML doc

 
 
Tim:.
Guest
Posts: n/a
 
      04-02-2004
Hi

Can someone tell me how I generate a new XML file that I can then use with an XSLT file. I am trying to use an XML file generated from Microsoft Project or even better generate an XML file from the project file (MPP File) itself. Which I can then use with an XSLT file

I am new to XML and want to create a project viewer using XML, ASP and XHTML. I have an idea of how this should work but would really appritiate any help someone can offer. Is it possible to take an XML file and generate it in ASP without using an XSLT file??

Help me please

Thanks...
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      04-02-2004


Tim:. wrote:

> Can someone tell me how I generate a new XML file that I can then use
> with an XSLT file. I am trying to use an XML file generated from
> Microsoft Project or even better generate an XML file from the
> project file (MPP File) itself. Which I can then use with an XSLT
> file.
>
> I am new to XML and want to create a project viewer using XML, ASP
> and XHTML. I have an idea of how this should work but would really
> appritiate any help someone can offer. Is it possible to take an XML
> file and generate it in ASP without using an XSLT file???


If you want to create an XML document in memory you can use the DOM,
MSXML is the component that supports that, if you want to do it a lot
you might want to download MSXML 4 from msdn.microsoft.com, it comes
with an SDK documentation.
Here is an example ASP page that creates a DOM document with a root
element <riders> and two child <rider> elements and then outputs it to
the browser by transforming it to HTML:

<%@ Language="VBScript" %>
<%
Option Explicit
Dim XmlDocument, XmlElement, XslDocument
Set XmlDocument = Server.CreateObject("Msxml2.DOMDocument.4.0")
XmlDocument.AppendChild(xmlDocument.CreateElement( "riders"))
Set XmlElement = XmlDocument.CreateElement("rider")
XmlElement.AppendChild(XmlDocument.CreateTextNode( "Armstrong"))
XmlDocument.DocumentElement.AppendChild(XmlElement )
Set XmlElement = XmlDocument.CreateElement("rider")
XmlElement.AppendChild(XmlDocument.CreateTextNode( "Ullrich"))
XmlDocument.DocumentElement.AppendChild(XmlElement )

Set XslDocument = Server.CreateObject("Msxml2.DOMDocument.4.0")
XslDocument.Async = False
XslDocument.Load(Server.MapPath("test20040402Xsl.x ml"))

XmlDocument.TransformNodeToObject XslDocument, Response
%>

The XSLT example is

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlnssl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xslutput method="html" indent="yes" encoding="UTF-8" />

<xsl:template match="/">
<html>
<head>
<title>Riders</title>
</head>
<body>
<xsl:apply-templates select="riders" />
</body>
</html>
</xsl:template>

<xsl:template match="riders">
<ol><xsl:apply-templates select="rider" /></ol>
</xsl:template>

<xsl:template match="rider">
<li><xsl:value-of select="." /></li>
</xsl:template>

</xsl:stylesheet>


--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.pdf doc to word doc PWB Computer Support 14 09-19-2008 10:41 PM
String[] files = {"a.doc, b.doc"}; VERSUS String[] files = new String[] {"a.doc, b.doc"}; Matt Java 3 09-17-2004 10:28 PM
ASP XML Support - Generate XML string from FORM DATA based on XML schema Matt ASP General 3 04-23-2004 07:12 PM
Converting a org.jdom DOC to org.w3c DOC Praveen Chhangani XML 2 08-07-2003 08:22 AM
Parsing MS Word client doc into server-side doc... John Wallace ASP .Net 0 07-22-2003 06:49 PM



Advertisments