Inside Coldfusion MX

"-->

XmlTransform (xmlString, xslString)

Description

Applies an eXtensible Stylesheet Language Transformation (XSLT) to an XML document object that is represented as a string variable. An XSLT converts an XML document to another format or representation by applying an eXtensible Stylesheet Language (XSL) style sheet to it.

Example

In this example, we are joining two preexisting files. To test this function, you will need to have a preexisting XML file and an XSL file to use the transform function on.

<cffile action="read" file="d:\cfusionmx\wwwroot\xml\people.xml" variable="myxml"> <cffile action="read" file="d:\cfusionmx\wwwroot\xml\people.xsl" variable="xslDoc"> <cfset xslAsString=ToString(xslDoc)> <cfset mydocAsString=ToString(myxml)> <cfset transformedXML = XmlTransform(mydocAsString, xslAsString)> <cffile action="write" file="d:\cfusionmx\wwwroot\xml\resulhtm.html" output="#transformedXML#"> <cfdump var = #transformedXML#>

Категории