How to call XSLT from an ASP page

Results 1 to 2 of 2

Thread: How to call XSLT from an ASP page

  1. #1
    Join Date
    Dec 1969

    Default How to call XSLT from an ASP page

    What is the correct way to reference an XSLt from an ASP page?<BR><BR>The way I am doing it is writing the whole XSLT file into the HTML of the ASP page ...<BR><BR>I have this in my ASP page:<BR><BR>&#060;?xml-stylesheet type="text/xsl" href="../Assets/Styles/sitewide.xml"?&#062;<BR><BR> <BR>Then this in my XML:<BR><BR>&#060;?xml-stylesheet type="text/xsl" href="../Assets/Styles/Marketing.xslt"?&#062;<BR>&#060;Marketing&#062;<BR > &#060;LinkBrickDetails Title="Get Enrolled" Image="/resources/images/consulting1.jpg" URL="" /&#062;<BR>&#060;/Marketing&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: How to call XSLT from an ASP page

    Hi,<BR>I have been working on this for about 2 days now and now I&#039;m in a hard spot passing variables to the xsl to make a prev next button. here is the ASP that I use to display the XML with an XSL template.<BR><BR>response.write getXML(sourceFile, xslFile)<BR><BR>Function getXML(sourceFile, xsl) <BR> dim styleFile <BR> dim source, style <BR> styleFile = Server.MapPath(xsl)<BR> <BR> Dim xmlhttp<BR> Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")<BR> xmlhttp.Open "GET", sourceFile, false<BR> xmlhttp.Send<BR> <BR> set source = Server.CreateObject("Microsoft.XMLDOM")<BR> source.async = false <BR> source.loadxml(xmlhttp.ResponseText) <BR> &#039;Check for a successful load of the XML Document.<BR> if source.parseerror.errorcode &#060;&#062; 0 then <BR> Response.Write "Error loading XML Document :" & "<BR>"<BR> Response.Write "----------------------------" & "<BR>"<BR> Response.Write "Error Code : " & source.parseerror.errorcode & "<BR>"<BR> Response.Write "Reason : " & source.parseerror.reason & "<BR>"<BR> Response.End <BR> End If<BR> <BR> <BR> set style = Server.CreateObject("Microsoft.XMLDOM")<BR> style.async = false<BR> &#039;set xasp = new ASPObjects <BR> &#039;style.addObject xasp, "urn:asp-objects"<BR> &#039;set xasp = nothing<BR> &#039;Check for a successful load of the XSL Document.<BR> style.load(styleFile)<BR> if style.parseerror.errorcode &#060;&#062; 0 then <BR> Response.Write "Error loading XSL Document :" & "<BR>"<BR> Response.Write "----------------------------" & "<BR>"<BR> Response.Write "Error Code : " & style.parseerror.errorcode & "<BR>"<BR> Response.Write "Reason : " & style.parseerror.reason & "<BR>"<BR> Response.End <BR> End If<BR><BR> getXML = source.transformNode(style) <BR> set source = nothing <BR> set style = nothing <BR>End Function<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts