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

TransformXML function.. Best?

Subject: TransformXML function.. Best?
From: "Gavin Landon" <gavin@xxxxxxxxxxx>
Date: Tue, 23 Jan 2001 10:43:29 -0600
transformxml error
Is this the best way to translate XML to HTML from ASP?

Response.Write TransformXML(sXMLFile, sXSLFile)

function TransformXML(strXMLDoc, strXSLDoc)
	'on error resume next
	dim objXMLDoc
	dim objXSLDoc
	dim strResults
	
	PROG_ID = "MSXML2.DOMDocument"

	if err.number = 0 then
	' Parse the XML Document
	set objXMLDoc = server.CreateObject(PROG_ID)
	objXMLDoc.async = false
	objXMLDoc.load(strXMLDoc)

	if objXMLDoc.parseError.errorCode = 0 then
		'Parse the XSL stylesheet
		set objXSLDoc = server.CreateObject(PROG_ID)
		objXSLDoc.async = false
		objXSLDoc.load(strXSLDoc)
		if objXSLDoc.parseError.errorCode = 0 then
			'If no errors, transform the XML 
			'into HTML using the XSL stylesheet
		  	strResults = objXMLDoc.transformNode(objXSLDoc)
		else
			strResults = "The following error " & _
		  		"occurred while processing the XSL " & _
				"stylesheet: <br>" & _
		  		objXSLDoc.parseError.errorCode & ", " & _
				objXSLDoc.parseError.reason
		end if
	else
		strResults = "The following error  " & _
			"occurred while processing the XML  " & _
			"document: <br>" & objXMLDoc.parseError.errorCode & _
			", " & objXMLDoc.parseError.reason
	end if	
	else
		strResults = "The following error occurred: <br>" & _
			err.number & ", " & err.description
	end if
	
	TransformXML=strResults

	' Clean up
	set objXSLDoc = nothing
	set objXMLDoc = nothing
end function

--
Gavin Landon
Karland International
http://www.karland.com/



 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.