• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

XForm problem during migration from CF8 to CF11(NimoiXForms)

New Here ,
Feb 19, 2015 Feb 19, 2015

Copy link to clipboard

Copied

I have inherited a website which I am currently migrating to CF11 from CF8.

The issue I am having is with xforms. The website is using NimoiXForms. I have setup all the mappings in ColdFusion Administrator, so it looks to be a code error.

I know its old but does anyone know if its compatible with CF11 or can point me in the right direction.

Here is the error:

Error Occurred While Processing Request

An error occurred while Transforming an XML document.

Cannot create an attribute node (iteration) whose parent is a document node. Most recent element start tag was output at line 127 of module

The error occurred in

D:/xFormsRoot/xtrasXForms/Questionnaires/XtrasNimoixForms/NimoiXFormsEditor.cfm: line 168

166 :  <!---  [0<cfdump var="#xFormXML#" expand="no">] --->

167 : <cflock timeout="60" throwontimeout="Yes" name="#sThisDir##sUserFilename#Temp" type="READONLY">

168 : <CFSET sBoundForm = XmlTransform(xFormXML, XSLTValidationIntoFormMerge)>

169 : </cflock>

170 : <!--- <cfset iEnd = getTickCount() - iBegin >

Any help will be appreciated.

Views

299

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 19, 2015 Feb 19, 2015

Copy link to clipboard

Copied

You probably want to look at getting rid of xforms.  No modern browser supports it natively and would require a plugin for it to work.  Firefox dropped support for it back in 2012.  Considering you are upgrading a system from CF8 to CF11 you will probably run into a bunch of issues like this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 20, 2015 Feb 20, 2015

Copy link to clipboard

Copied

Thank you fro the feed back. Do you know of any other programs that would be suitable to replace it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 20, 2015 Feb 20, 2015

Copy link to clipboard

Copied

LATEST

I have looked in more detail at the xforms running in our website and they are server side not client. So should be unaffected by browsers. The error above seems to be caused by the following code which is using XSLT 1.0. Does CF11 require XSLT 2.0?

<!--- This XSLT merges the form and the latest iteration of the user data to produce the user form --->
<cfsavecontent variable="XSLTValidationIntoFormMerge">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" version="1.0" encoding="windows-1252" indent="yes"/>
   <!--- define and load as a variable, the XML that is the form's validation--->
   <!--- define and load as a variable, the XML that is the user's latest iteration data --->
   <xsl:variable name="userdoc" select="document('<cfoutput>#sThisDir#\..\Temp#sUserFilename#</cfoutput>')"/>
   <!--- <xsl:variable name="validationdoc" select="document('<cfoutput>#sThisDir#\#sValidationFilename#</cfoutput>')"/> --->
  
   <!--- As we're running this XSLT against the Xforms definition, we want to examine every element and attribute --->
   <xsl:template match="*|@*">
   
    <xsl:copy>
     <xsl:apply-templates select="*|@*"/>
     <!--- <xsl:apply-templates select="*"/> --->
    </xsl:copy>
    <xsl:attribute name="iteration">1</xsl:attribute>
    <xsl:attribute name="userid"><cfoutput>#uUserID#</cfoutput></xsl:attribute>
    <!--- add the iteration and userID --->
    <!--- <xsl:attribute name="iteration">
     <xsl:value-of select="$userdoc/userdata/iteration/@numb"/>
    </xsl:attribute> --->
    <!---
    **************
    <xsl:attribute name="iteration"><cfoutput>#client.QJXIteration#</cfoutput></xsl:attribute>
    **************
    --->
   
   </xsl:template>
  

   <!--- for an input element in the Xforms do this --->
   <xsl:template match="input">
    <!--- set the name attribute to the value of the ref attribute (Xforms elements are named by the ref attribute) --->
    <xsl:variable name="ref" select="@ref"/>
    <xsl:copy>
     <!--- add any validation attributes that exists for this element --->
     <!--- <xsl:apply-templates select="@"/> --->
     <!--- <xsl:copy-of select="$validationdoc/validation/*[name() = $ref]/@*"/> --->
     <!--- add any user data that exists for this element as a value attribute --->
     <xsl:choose>
      <xsl:when test="string-length(normalize-space($userdoc/userdata/iteration/*[name() = $ref])) != 0">
       <xsl:attribute name="value"><xsl:value-of select="$userdoc/userdata/iteration/*[name() = $ref]"/></xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
       <xsl:attribute name="value"><xsl:value-of select="@defaultvalue"/></xsl:attribute>
      </xsl:otherwise>
     </xsl:choose>
     <xsl:attribute name="ref"><xsl:value-of select="$ref"/></xsl:attribute>
     <xsl:attribute name="appearance"><xsl:value-of select="@appearance"/></xsl:attribute>
     <xsl:attribute name="required"><xsl:value-of select="@required"/></xsl:attribute>
     <xsl:attribute name="validationmsg"><xsl:value-of select="@validationmsg"/></xsl:attribute>
     <xsl:attribute name="expression"><xsl:value-of select="@expression"/></xsl:attribute>
     <xsl:attribute name="defaultvalue"><xsl:value-of select="@defaultvalue"/></xsl:attribute>
     <xsl:attribute name="keylist"><xsl:value-of select="@keylist"/></xsl:attribute>
     <xsl:attribute name="hidden"><xsl:value-of select="@hidden"/></xsl:attribute>
     <xsl:copy-of select="*"/>
    </xsl:copy>
   </xsl:template>
  
   <!--- for a password element in the Xforms do this --->
   <xsl:template match="secret">
    <!--- set the name attribute to the value of the ref attribute (Xforms elements are named by the ref attribute) --->
    <xsl:variable name="ref" select="@ref"/>
    <xsl:copy>
     <!--- add any validation attributes that exists for this element --->
     <!--- <xsl:apply-templates select="@"/> --->
     <!--- <xsl:copy-of select="$validationdoc/validation/*[name() = $ref]/@*"/> --->
     <!--- add any user data that exists for this element as a value attribute --->
     <xsl:choose>
      <xsl:when test="string-length(normalize-space($userdoc/userdata/iteration/*[name() = $ref])) != 0">
       <xsl:attribute name="value"><xsl:value-of select="$userdoc/userdata/iteration/*[name() = $ref]"/></xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
       <xsl:attribute name="value"><xsl:value-of select="@defaultvalue"/></xsl:attribute>
      </xsl:otherwise>
     </xsl:choose>
     <xsl:attribute name="ref"><xsl:value-of select="$ref"/></xsl:attribute>
     <xsl:attribute name="appearance"><xsl:value-of select="@appearance"/></xsl:attribute>
     <xsl:attribute name="required"><xsl:value-of select="@required"/></xsl:attribute>
     <xsl:attribute name="validationmsg"><xsl:value-of select="@validationmsg"/></xsl:attribute>
     <xsl:attribute name="expression"><xsl:value-of select="@expression"/></xsl:attribute>
     <xsl:attribute name="defaultvalue"><xsl:value-of select="@defaultvalue"/></xsl:attribute>
     <xsl:attribute name="keylist"><xsl:value-of select="@keylist"/></xsl:attribute>
     <xsl:attribute name="hidden"><xsl:value-of select="@hidden"/></xsl:attribute>
     <xsl:copy-of select="*"/>
    </xsl:copy>
   </xsl:template>
  
   <!--- for an upload element in the Xforms do this --->
   <xsl:template match="upload">
    <!--- set the name attribute to the value of the ref attribute (Xforms elements are named by the ref attribute) --->
    <xsl:variable name="ref" select="@ref"/>
    <xsl:copy>
     <!--- add any validation attributes that exists for this element --->
     <!--- <xsl:apply-templates select="@"/> --->
     <!--- <xsl:copy-of select="$validationdoc/validation/*[name() = $ref]/@*"/> --->
     <!--- add any user data that exists for this element as a value attribute --->
     <!--- <xsl:choose>
      <xsl:when test="string-length(normalize-space($userdoc/userdata/iteration/*[name() = $ref])) != 0">
       <xsl:attribute name="value"><xsl:value-of select="$userdoc/userdata/iteration/*[name() = $ref]"/></xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
       <xsl:attribute name="value"><xsl:value-of select="@defaultvalue"/></xsl:attribute>
      </xsl:otherwise>
     </xsl:choose> --->
     <xsl:attribute name="value"><xsl:value-of select="$userdoc/userdata/iteration/*[name() = $ref]"/></xsl:attribute>
     <xsl:attribute name="ref"><xsl:value-of select="$ref"/></xsl:attribute>
     <xsl:attribute name="appearance"><xsl:value-of select="@appearance"/></xsl:attribute>
     <xsl:attribute name="required"><xsl:value-of select="@required"/></xsl:attribute>
     <xsl:attribute name="validationmsg"><xsl:value-of select="@validationmsg"/></xsl:attribute>
     <xsl:attribute name="expression"><xsl:value-of select="@expression"/></xsl:attribute>
     <xsl:attribute name="defaultvalue"><xsl:value-of select="@defaultvalue"/></xsl:attribute>
     <xsl:attribute name="keylist"><xsl:value-of select="@keylist"/></xsl:attribute>
     <xsl:attribute name="hidden"><xsl:value-of select="@hidden"/></xsl:attribute>
     <xsl:copy-of select="*"/>
    </xsl:copy>
   </xsl:template>
  
   <xsl:template match="textarea">
    <xsl:variable name="ref" select="@ref"/>
    <xsl:copy>
     <!--- <xsl:apply-templates select="@"/> --->
     <!--- <xsl:copy-of select="$validationdoc/validation/*[name() = $ref]/@*"/> --->
     <xsl:choose>
      <xsl:when test="string-length(normalize-space($userdoc/userdata/iteration/*[name() = $ref])) != 0">
       <xsl:attribute name="value"><xsl:value-of select="$userdoc/userdata/iteration/*[name() = $ref]"/></xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
       <xsl:attribute name="value"><xsl:value-of select="@defaultvalue"/></xsl:attribute>
      </xsl:otherwise>
     </xsl:choose>
     <xsl:attribute name="ref"><xsl:value-of select="$ref"/></xsl:attribute>
     <xsl:attribute name="appearance"><xsl:value-of select="@appearance"/></xsl:attribute>
     <xsl:attribute name="required"><xsl:value-of select="@required"/></xsl:attribute>
     <xsl:attribute name="validationmsg"><xsl:value-of select="@validationmsg"/></xsl:attribute>
     <xsl:attribute name="expression"><xsl:value-of select="@expression"/></xsl:attribute>
     <xsl:attribute name="defaultvalue"><xsl:value-of select="@defaultvalue"/></xsl:attribute>
     <xsl:attribute name="keylist"><xsl:value-of select="@keylist"/></xsl:attribute>
     <xsl:attribute name="hidden"><xsl:value-of select="@hidden"/></xsl:attribute>
     <xsl:copy-of select="*"/>
    </xsl:copy>
   </xsl:template>
  
   <xsl:template match="output">
    <xsl:variable name="ref" select="@ref"/>
    <xsl:variable name="uvalue" select="normalize-space($userdoc/userdata/iteration/*[name() = $ref])"/>
    <xsl:variable name="dvalue" select="normalize-space(@defaultvalue)"/>
    <xsl:copy>
     <xsl:attribute name="ref"><xsl:value-of select="$ref"/></xsl:attribute>
     <xsl:attribute name="appearance"><xsl:value-of select="@appearance"/></xsl:attribute>
     <xsl:attribute name="required"><xsl:value-of select="@required"/></xsl:attribute>
     <xsl:attribute name="validationmsg"><xsl:value-of select="@validationmsg"/></xsl:attribute>
     <xsl:attribute name="expression"><xsl:value-of select="@expression"/></xsl:attribute>
     <xsl:attribute name="defaultvalue"><xsl:value-of select="@defaultvalue"/></xsl:attribute>
     <xsl:attribute name="keylist"><xsl:value-of select="@keylist"/></xsl:attribute>
     <xsl:attribute name="hidden"><xsl:value-of select="@hidden"/></xsl:attribute>
     <xsl:choose>
      <xsl:when test="(@appearance='full') or (@appearance='compact')">
       <xsl:copy-of select="./linebreakvalues"/>
       <xsl:copy-of select="./clientjavascript"/>
       <xsl:copy-of select="./formatting"/>
       <xsl:copy-of select="./label"/>
       <xsl:copy-of select="./hint"/>
       <xsl:choose>
        <xsl:when test="string-length($uvalue) != 0">
         <xsl:for-each select="./item">
          <xsl:if test="$userdoc/userdata/iteration/*[name() = $ref]=./value">
           <xsl:element name="item">
            <xsl:value-of select="./value"/>
           </xsl:element>
          </xsl:if>
         </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
         <xsl:for-each select="./item">
          <xsl:if test="$dvalue= normalize-space(value)">
           <xsl:element name="item">
            <xsl:value-of select="./value"/>
           </xsl:element>
          </xsl:if>
         </xsl:for-each>
        </xsl:otherwise>
       </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
       <xsl:choose>
        <xsl:when test="string-length(normalize-space($userdoc/userdata/iteration/*[name() = $ref])) != 0">
         <xsl:attribute name="value"><xsl:value-of select="$userdoc/userdata/iteration/*[name() = $ref]"/></xsl:attribute>
        </xsl:when>
        <xsl:otherwise>
         <xsl:attribute name="value"><xsl:value-of select="@defaultvalue"/></xsl:attribute>
        </xsl:otherwise>
       </xsl:choose>
       <xsl:copy-of select="*"/>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:copy>
   </xsl:template>
  
  

   <xsl:template match="select1">
    <xsl:variable name="ref" select="@ref"/>
    <xsl:variable name="uvalue" select="normalize-space($userdoc/userdata/iteration/*[name() = $ref])"/>
    <xsl:variable name="dvalue" select="normalize-space(@defaultvalue)"/>
   
    <xsl:element name="select1">
     <!--- <xsl:apply-templates select="@"/> --->
     <!--- <xsl:copy-of select="$validationdoc/validation/*[name() = $ref]/@*"/> --->
     <xsl:attribute name="ref">
      <xsl:value-of select="$ref"/>
     </xsl:attribute>
    
     <xsl:attribute name="appearance"><xsl:value-of select="@appearance"/></xsl:attribute>
     <xsl:attribute name="required"><xsl:value-of select="@required"/></xsl:attribute>
     <xsl:attribute name="validationmsg"><xsl:value-of select="@validationmsg"/></xsl:attribute>
     <xsl:attribute name="expression"><xsl:value-of select="@expression"/></xsl:attribute>
     <xsl:attribute name="keylist"><xsl:value-of select="@keylist"/></xsl:attribute>
     <xsl:attribute name="hidden"><xsl:value-of select="@hidden"/></xsl:attribute>
    
     <xsl:copy-of select="./linebreakvalues"/>
     <xsl:copy-of select="./clientjavascript"/>
     <xsl:copy-of select="./formatting"/>
     <xsl:copy-of select="./label"/>
     <xsl:copy-of select="./hint"/>

     <xsl:choose>
      <xsl:when test="string-length($uvalue) != 0">
       <xsl:for-each select="./item">
        <xsl:element name="item">
         <xsl:if test="$uvalue = value">
          <xsl:attribute name="selected">true</xsl:attribute>
         </xsl:if>
         <xsl:copy-of select="./*"/>
        </xsl:element>
       </xsl:for-each>
       <xsl:call-template name="doKeylistItems">
        <xsl:with-param name="list" select="@keylist"/>
        <xsl:with-param name="thisObjValue" select="$uvalue"/>
       </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
       <xsl:for-each select="./item">
        <xsl:element name="item">
         <xsl:if test="$dvalue= normalize-space(value)">
          <xsl:attribute name="selected">true</xsl:attribute>
         </xsl:if>
         <xsl:copy-of select="./*"/>
        </xsl:element>
       </xsl:for-each>
       <xsl:call-template name="doKeylistItems">
        <xsl:with-param name="list" select="@keylist"/>
        <xsl:with-param name="thisObjValue" select="$dvalue"/>
       </xsl:call-template>
      </xsl:otherwise>
     </xsl:choose>    
    </xsl:element>
   
   </xsl:template>
  
   <xsl:template match="select">
    <xsl:variable name="ref" select="@ref"/>
    <xsl:variable name="uvalue" select="normalize-space($userdoc/userdata/iteration/*[name() = $ref])"/>
    <xsl:variable name="dvalue" select="normalize-space(@defaultvalue)"/>
    <xsl:element name="select">
     <!--- <xsl:apply-templates select="@"/> --->
     <!--- <xsl:copy-of select="$validationdoc/validation/*[name() = $ref]/@*"/> --->
     <xsl:attribute name="ref"><xsl:value-of select="$ref"/></xsl:attribute>
     <xsl:attribute name="appearance"><xsl:value-of select="@appearance"/></xsl:attribute>
     <xsl:attribute name="required"><xsl:value-of select="@required"/></xsl:attribute>
     <xsl:attribute name="validationmsg"><xsl:value-of select="@validationmsg"/></xsl:attribute>
     <xsl:attribute name="expression"><xsl:value-of select="@expression"/></xsl:attribute>
     <xsl:attribute name="keylist"><xsl:value-of select="@keylist"/></xsl:attribute>
     <xsl:attribute name="hidden"><xsl:value-of select="@hidden"/></xsl:attribute>
    
    
     <xsl:copy-of select="./linebreakvalues"/>
     <xsl:copy-of select="./clientjavascript"/>
     <xsl:copy-of select="./formatting"/>
     <xsl:copy-of select="./label"/>
     <xsl:copy-of select="./hint"/>
    
     <!--- <xsl:for-each select="./item">
       <xsl:element name="item">
        <xsl:if test="$userdoc/userdata/iteration/*[name() = $ref]=./value">
         <xsl:attribute name="selected">true</xsl:attribute>
        </xsl:if>
        <xsl:copy-of select="./*"/>
       </xsl:element>
     </xsl:for-each>
    
     <xsl:call-template name="doKeylistItems">
      <xsl:with-param name="list" select="@keylist"/>
      <xsl:with-param name="thisobjname" select="$ref"/>
     </xsl:call-template> --->
    
     <xsl:choose>
      <xsl:when test="string-length($uvalue) != 0">
       <xsl:for-each select="./item">
        <xsl:element name="item">
         <!--- <xsl:if test="$uvalue = value">
          <xsl:attribute name="selected">true</xsl:attribute>
         </xsl:if>  --->
         <xsl:if test="$userdoc/userdata/iteration/*[name() = $ref]=./value">
          <xsl:attribute name="selected">true</xsl:attribute>
         </xsl:if>
         <xsl:copy-of select="./*"/>
        </xsl:element>
       </xsl:for-each>
       <xsl:call-template name="doKeylistItems">
        <xsl:with-param name="list" select="@keylist"/>
        <xsl:with-param name="thisObjValue" select="$uvalue"/>
       </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
       <xsl:for-each select="./item">
        <xsl:element name="item">
         <xsl:if test="$dvalue= normalize-space(value)">
          <xsl:attribute name="selected">true</xsl:attribute>
         </xsl:if>
         <xsl:copy-of select="./*"/>
        </xsl:element>
       </xsl:for-each>
       <xsl:call-template name="doKeylistItems">
        <xsl:with-param name="list" select="@keylist"/>
        <xsl:with-param name="thisObjValue" select="$dvalue"/>
       </xsl:call-template>
      </xsl:otherwise>
     </xsl:choose>
    
     <!--- <xsl:call-template name="doKeylistItems">
      <xsl:with-param name="list" select="$validationdoc/validation/*[name() = $ref]/@keylist"/>
     
     </xsl:call-template> --->
    </xsl:element>

   </xsl:template>
  
  
   <xsl:template name="doKeylistItems">
    <xsl:param name="list"/>
    <xsl:param name="thisObjValue"/>
   

    <xsl:choose>
     <!--- does the list contain any commas i.e multiple values--->
     <xsl:when test="contains($list,',')">
      <!--- yes - create an element --->
      <!--- set the value to the first item in the list --->
       <xsl:for-each select="$userdoc/userdata/iteration/*[name() = substring-before(normalize-space($list),',')]">
        <xsl:if test="string-length(normalize-space(text())) != 0">
         <xsl:element name="item">
          <xsl:if test="$thisObjValue=text()">
           <xsl:attribute name="selected">true</xsl:attribute>
          </xsl:if>
          <xsl:element name="value">
           <xsl:value-of select="text()"/>
          </xsl:element>
          <xsl:element name="hint">
           <xsl:value-of select="text()"/>
          </xsl:element>
          <xsl:element name="label">
           <xsl:value-of select="text()"/>
          </xsl:element>
         </xsl:element>
        </xsl:if>
       </xsl:for-each>
     
      <!--- if there are anymore items in the list then recall again with the remainder of the list --->
      <xsl:if test="substring-after(normalize-space($list),',')">
       <xsl:call-template name="doKeylistItems">
        <xsl:with-param name="list" select="substring-after(normalize-space($list),',')"/>
        <xsl:with-param name="thisObjValue" select="$thisObjValue"/>
       </xsl:call-template>
      </xsl:if>
     </xsl:when>
     <!--- if there are no commas then there must be only one value so create an element and finish --->
     <xsl:when test="not(contains($list,',')) ">
      <xsl:for-each select="$userdoc/userdata/iteration/*[name() = normalize-space($list)]">
       <xsl:if test="string-length(normalize-space(text())) != 0">
        <xsl:element name="item">
         <xsl:if test="$thisObjValue=text()">
          <xsl:attribute name="selected">true</xsl:attribute>
         </xsl:if>
         <xsl:element name="value">
          <xsl:value-of select="text()"/>
         </xsl:element>
         <xsl:element name="hint">
          <xsl:value-of select="text()"/>
         </xsl:element>
         <xsl:element name="label">
           <xsl:value-of select="text()"/>
          </xsl:element>
        </xsl:element>
       </xsl:if>
      </xsl:for-each>
     </xsl:when>
    </xsl:choose>
   </xsl:template>
  
</xsl:stylesheet>
</cfsavecontent>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation