Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP Include of an XML file

Reply
Thread Tools

ASP Include of an XML file

 
 
VBH
Guest
Posts: n/a
 
      10-01-2004
This is probably a silly question but...

I have an XML file which processes quite happily with XSL when opened on
its own.

However, I just want to include it in an ASP file. But when I do an
SSI, the XML is not reformatted by the XSL.

As in:
<!-- #INCLUDE FILE="2003-06.XML" -->

The XML file includes
<?xml-stylesheet type="text/xsl" href="blog2.xsl"?>

Which works fine when the XML file is opened on its own. However when I
try it as an SSI, I just get the text as one long string.

Its for a site front page and is the XML blog for "what's new". I've
written my own blogging app which outputs xml files. I don't want to
put a load of processing into the front page that I have already handled
with XSL.

So how do you do an ASP SSI of an XML document and get it to fire the XSL?

Any suggestions?

TIA
--------------------
VBH
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      10-01-2004
VBH wrote:
> This is probably a silly question but...
>
> I have an XML file which processes quite happily with XSL when opened
> on its own.
>
> However, I just want to include it in an ASP file. But when I do an
> SSI, the XML is not reformatted by the XSL.
>
> As in:
> <!-- #INCLUDE FILE="2003-06.XML" -->
>
> The XML file includes
> <?xml-stylesheet type="text/xsl" href= "blog2.xsl" ?>
>
> Which works fine when the XML file is opened on its own. However
> when I try it as an SSI, I just get the text as one long string.
>
> Its for a site front page and is the XML blog for "what's new". I've
> written my own blogging app which outputs xml files. I don't want to
> put a load of processing into the front page that I have already
> handled with XSL.
>
> So how do you do an ASP SSI of an XML document and get it to fire the
> XSL?
> Any suggestions?
>
> TIA
> --------------------
> VBH


Use the transformNode method of the dom document to transform the document.
(you'll have to remove the ?xml-stylesheet tag)

set xmldoc=createobject("msxml.domdocument")
xmldoc.load("2003-06.XML")
set xsldoc=createobject("msxml.domdocument")
xmldoc.load("blog2.xsl")
response.write xmldoc.transformnode(xsldoc)

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
 
VBH
Guest
Posts: n/a
 
      10-01-2004
Bob Barrows [MVP] wrote:

> VBH wrote:
>
>>This is probably a silly question but...
>>
>>I have an XML file which processes quite happily with XSL when opened
>>on its own.
>>
>>However, I just want to include it in an ASP file. But when I do an
>>SSI, the XML is not reformatted by the XSL.
>>
>>As in:
>><!-- #INCLUDE FILE="2003-06.XML" -->
>>
>>The XML file includes
>><?xml-stylesheet type="text/xsl" href= "blog2.xsl" ?>
>>
>>Which works fine when the XML file is opened on its own. However
>>when I try it as an SSI, I just get the text as one long string.
>>
>>Its for a site front page and is the XML blog for "what's new". I've
>>written my own blogging app which outputs xml files. I don't want to
>>put a load of processing into the front page that I have already
>>handled with XSL.
>>
>>So how do you do an ASP SSI of an XML document and get it to fire the
>>XSL?
>>Any suggestions?
>>
>>TIA
>>--------------------
>>VBH

>
>
> Use the transformNode method of the dom document to transform the document.
> (you'll have to remove the ?xml-stylesheet tag)
>
> set xmldoc=createobject("msxml.domdocument")
> xmldoc.load("2003-06.XML")
> set xsldoc=createobject("msxml.domdocument")
> xmldoc.load("blog2.xsl")
> response.write xmldoc.transformnode(xsldoc)
>
> Bob Barrows


I'd just come to that conclusion. I was hoping I was making some simple
syntactic error. At least this little chunk of code is not too excessive

Thanks
--------------------
VBH
 
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
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
ASP Include file error <!-- #include file="" --> naveeddil ASP .Net 0 01-04-2008 12:58 PM
ASP Error 0126 include file not found, when using ".." in include file path Eric ASP General 10 01-11-2007 07:38 AM
ASP Error 0126 include file not found, when using ".." in include file path Eric ASP General 0 01-09-2007 06:54 PM
#include "file" -vs- #include <file> Victor Bazarov C++ 4 03-06-2005 07:09 PM



Advertisments