![]() |
The xslt.asp Include File |
Search [jebjbhfj] |
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Other Xoc managed sites: http://grr.xoc.net http://www.986faq.com http://www.mayainfo.org https://mayacalendar.xoc.net http://www.yachtslog.com |
<% Function CreateHTMLFromXMLXSL(strXmlDoc, strXslDoc, astrParamValue) 'Call this function using the following syntax: ' <!--#include virtual="xslt.asp"--> ' <[percent symbol] ' =CreateHTMLFromXMLXSL( _ ' Server.MapPath("filename.xml"), _ ' Server.MapPath("filename.xsl"), _ ' astrParamValue)) ' [percent symbol]> 'Where filename.xml and filename.xsl are replaced with 'the appropriate xml and xsl filenames, 'and [percent symbol] is replaced by a % 'astrParamValue is either Empty or 'it is an array of names and values of parameters Dim domXml Dim domStyle Dim nodParam Dim iastrParamValue set domXml = Server.CreateObject("msxml2.domdocument") domXml.async = False domXml.validateOnParse = False Call domXml.setProperty("SelectionLanguage", "XPath") Call domXml.setProperty("ServerHTTPRequest", 1) On Error Resume Next If domXml.load(strXmlDoc) Then Set domStyle = Server.CreateObject("msxml2.domdocument") domStyle.async = False domStyle.validateOnParse = False Call domStyle.setProperty("ServerHTTPRequest", 1) If domStyle.load(strXslDoc) Then Call domStyle.setProperty("SelectionLanguage", "XPath") Call domStyle.setProperty("SelectionNamespaces", "xmlns:xsl=""http://www.w3.org/1999/XSL/Transform""") If Not IsEmpty(astrParamValue) Then For iastrParamValue = LBound(astrParamValue) To UBound(astrParamValue) Step 2 Set nodParam = domStyle.selectSingleNode("/descendant::xsl:param[@name='" _ & astrParamValue(iastrParamValue) & "']") nodParam.Text = astrParamValue(iastrParamValue + 1) Next End If CreateHTMLFromXMLXSL = domXml.transformNode(domStyle.documentElement) Else CreateHTMLFromXMLXSL = XMLError(domStyle.parseError, strXSLDoc) End If Else CreateHTMLFromXMLXSL = XMLError(domXml.parseError, strXMLDoc) End If Set domStyle = Nothing Set domXml = Nothing End Function Function XMLError(parseError, strDoc) XMLError = "Error in line " & Clng(parseError.line) & " of " & strDoc & "<br />" _ & parseError.reason End Function %> |
||
Top |
[www.xoc.net] Copyright © 1997-2023 by Gregory Reddick ![]() |