Subject: Re: [xsl] TransformXML function.. Best? From: "Gavin Landon" <gavin@xxxxxxxxxxx> Date: Tue, 23 Jan 2001 11:39:49 -0600 |
Is this one of those too easy to answer questions. Sorry, I have been out of the loop for a while and now getting back into it. *********** REPLY SEPARATOR *********** On 1/23/01 at 10:43 AM Gavin Landon wrote: >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 -- Gavin Landon Karland International http://www.karland.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] TransformXML function.. Best?, Gavin Landon | Thread | [xsl] Serious problems finding synt, Gavin Landon |
Re: [xsl] using xsl:copy, cutlass | Date | Re: [xsl] Environment Information, Bob DuCharme |
Month |