[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How do I pass asp sql stream into xslt stylesheet?

Subject: RE: How do I pass asp sql stream into xslt stylesheet?
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Sat, 22 Dec 2001 09:03:32 -0000
new activexobject asp
David,
You need something like this
------test.js
	var xml = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
	var xmlo = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
	var tem = new ActiveXObject("MSXML2.XSLTemplate");
	var xsl = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
	var rs = new ActiveXObject("ADODB.Recordset");
	var strm = new ActiveXObject("ADODB.Stream");
	xml.async = false;
	xml.load("test.xml");
	xsl.async = false;
	xsl.load("test.xsl");
	tem.stylesheet = xsl;
	var proc = tem.createProcessor();
	rs.open("select * from test",
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\temp\\xmlasobj\\test.mdb;");

	rs.save(strm, 1); //adPersistXML
	xmlo.loadXML(strm.readText());
	proc.addObject(xmlo, "urn:cjb");

	proc.input = xml;
	proc.transform();
	var str = proc.output;
	WScript.echo(str);
------test.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:objxml="urn:cjb"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
>
	<xsl:variable name="objectxml"
select="objxml:selectSingleNode('/')" />
	<xsl:template match="/">	
		<html>
			<head></head>
			<body>
				<xsl:copy-of select="$objectxml/" />

			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>
------test.xml
<?xml version='1.0'?>
<test/>

Save all 3 files to C:\temp\xmlasobj create an access database called
test.mdb with one table called test
and then 
C:\temp\xmlasobj> cscript test.js
Will produce

<html xmlns:objxml="urn:cjb"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">
</head>
<body><xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<s:Schema id="RowsetSchema">
<s:ElementType name="row" content="eltOnly">
<s:AttributeType name="text" rs:number="1" rs:nullable="true"
rs:maydefer="true" rs:writeunknown="true">
<s:datatype dt:type="string" dt:maxLength="50"/>
</s:AttributeType>
<s:extends type="rs:rowbase"/>
</s:ElementType>
</s:Schema>
<rs:data>
<z:row text="this is a test from test table"/>
</rs:data>
</xml></body>
</html>
	
Now all you have to do is stick that into an asp and change your
database connection.

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.