Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP XML
|
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 31st, 2006, 03:21 PM
Registered User
 
Join Date: May 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Transforming XML data in an ASP file using XSLT

Hello everyone,
Initially, our ASP page sends out an ASP call to the webserver to retrieve the data from a database.
Presently, the webserver's response is a chunk of XML data (in a data island) and a javascript which has reference to the XSL file for transforming that XML data into HTML. The following is an example :
-------------------------------------------------------------
<XML id="xmlData"> <?xml version="1.0"?><MDML><UI><ActionItem actionItemType="Button" actionItemLabel="Change" actionItemId="ActionItem_Change_Button" altValue="Change" helpFile="HelpFile_AppCmds" gifSrc="change.gif" ><FrameWrkAction appId="SystemCapacityApp" funcId="FI_Add_Chg" funcArgs="ViewId=0.100" actionId="Action_ID_Change_Load" actionArgs="(None)" target="noTarget" aspLink="" ></FrameWrkAction></ActionItem></UI><MetaData></MetaData><DBData></DBData></MDML> </XML>

******************* --- XSL file Reference --- *******************
<SCRIPT language="JavaScript">
<!--

    var XSLFile= "xsl/uwi_RenderCmd.xsl";
//-->
</SCRIPT>
************************************************** ****************

The "content-type" of this response is "text/HTML" and is coded into the ASP page directly by the webserver.
Since this uses Data Islands (which makes it browser specific), I am trying to embed the XSL reference directly into the XML data and eliminate the DataIsland as shown below



<?xml version = "1.0"?>
<?xml-stylesheet type = "text/xsl" href = "xsl/uwi_RenderCmd.xsl"?>
.....

The good thing is that, as all browsers support XSLT, it works! But the problem is that it works ONLY if the XML data were stored in a file (with a ".XML" extension) on the server's directory and fed into the browser directly. As mentioned earlier, this data is present in an ASP file (which has a bunch of scripts which get loaded first before the browser processes this XML data). When it is processed, the browser is not recognizing it as XML data and is therefore not applying the Stylesheet on it.

Please be noted that when the ASP file is fed into Internet Explorer, the output is fine (i.e correct processing of XML and stylesheet) but it doesnot work on firefox or netscape.
Could anyone please describe a way I could tell the browser to process this chuck of XML data (of "text/HTML" content type) as "XML"?

You can either post the reply here, or could simple e-mail me at:
[email protected] (preferred)

I highly appreciate your patience in reading this lengthy e-mail.

Regards,
Asim





Similar Threads
Thread Thread Starter Forum Replies Last Post
Show CURRENT DATE when transforming XML using XSLT richieWolf XSLT 0 October 20th, 2007 07:47 PM
Exception when transforming using XSLT ksskumar XSLT 5 October 10th, 2006 06:20 AM
Transforming data in required XML Format pvasudevan XSLT 6 September 6th, 2006 02:34 AM
problem transforming XML using xslt micky3248 XSLT 7 August 18th, 2006 03:52 AM
Please help, xml transforming using xslt !!! daula7 XSLT 0 May 11th, 2006 01:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.