XSLTCF5(Source, Style)
Last updated September 20, 2004
Version: 1 | Requires: CF5 | Library: DataManipulationLib
Description:
Returns the Transformed content of an XML document from a specified XSL document. This function uses the MSXML processor. (Tested on MSXML3+)
Return Values:
Returns the XML data with formatting.
Example:
<!---
<cfset sourceDoc="#GetDirectoryFromPath(GetCurrentTemplatePath())#cd_list.xml">
<cfset styleDoc="#GetDirectoryFromPath(GetCurrentTemplatePath())#cd_list.xsl">
<cfoutput>#xsltcf5(sourceDoc,styleDoc)#</cfoutput>
Commented out since the COM object has issues on this box.
--->
Parameters:
Name | Description | Required |
---|---|---|
Source | XML Source | Yes |
Style | XML Stylesheet | Yes |
Full UDF Source:
/**
* Processes an XSL Template against an XML document and returns the transformed content.
*
* @param Source XML Source (Required)
* @param Style XML Stylesheet (Required)
* @return Returns the XML data with formatting.
* @author Joshua Miller (josh@joshuasmiller.com)
* @version 1, September 20, 2004
*/
function xsltcf5(source,style){
// Instantiate COM Objects
var objSource=CreateObject("COM", "Microsoft.XMLDOM", "INPROC");
var objStyle=CreateObject("COM", "Microsoft.XMLDOM", "INPROC");
var sourceReturn = "";
var styleReturn = "";
var styleRoot = "";
var xsloutput = "";
// Parse XML
objSource.async = "false";
sourceReturn = objSource.load("#source#");
// Parse XSL
objStyle.async = "false";
styleReturn = objStyle.load("#style#");
// Transform Document
styleRoot = objStyle.documentElement;
xsloutput = objSource.transformNode(styleRoot);
// Output Results
return xsloutput;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016