Note that there are some explanatory texts on larger screens.

plurals
  1. POColdFusion - pass XML as parameter to xmlTransform() in CF10
    primarykey
    data
    text
    <p>Good day - </p> <p>In ColdFusion 9, we could pass XML parameters to xmlTransform(), like this:</p> <pre><code>&lt;cfxml variable="parm"&gt; &lt;users&gt; &lt;user&gt;Joe Blow&lt;/user&gt; &lt;user&gt;Jane Doe&lt;/user&gt; &lt;/users&gt; &lt;/cfxml&gt; &lt;cfset params=structNew()&gt; &lt;cfset params["users"]=parm&gt; &lt;cfset newXML=xmlTransform(xmlFile,xslFile,params)&gt; </code></pre> <p>In the XSL then, we could accept the "users" argument:</p> <pre><code>&lt;xsl:param name="users" select="." /&gt; </code></pre> <p>And use it as a variable, run XPath on it, etc.</p> <p>However, with ColdFusion 10, passing an XML argument to any XSL results in an error. It is quite unhelpful, and none of the error logs show any detail.</p> <p>The error shown is simply:</p> <pre><code> An error occured while Transforming an XML document. </code></pre> <p>and</p> <blockquote> <p>coldfusion.xml.XmlProcessException: An error occured while Transforming an XML document. at coldfusion.xml.XmlProcessor.doTransform(XmlProcessor.java:508) at coldfusion.xml.XmlProcessor.access$100(XmlProcessor.java:82) at coldfusion.xml.XmlProcessor$3.run(XmlProcessor.java:455) at java.security.AccessController.doPrivileged(Native Method) at coldfusion.xml.XmlProcessor.transform(XmlProcessor.java:451) at coldfusion.xml.XmlProcessor.transform(XmlProcessor.java:440) at coldfusion.runtime.CFPage.XmlTransform(CFPage.java:359) at cftestxml2ecfm41929416.runPage(E:\test\testxml.cfm:36) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:444) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.IpFilter.invoke(IpFilter.java:64) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:443) at ) ... (etc)</p> </blockquote> <p>I've narrowed it down to specifically the action of passing XML as an argument. If it's changed to a string instead of XML, it "works" in the sense that it doesn't get this error. That's fine for an empty XSLT, but of course we need it to be passed as XML so that we can e.g. use XPath on the data.</p> <p>Has ColdFusion 10 changed so that it no longer allows XML parameters to xmlTransform()? Any help is greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload