2012-03-25 8 views
0

このコードブロックがxmlファイルエラーの早すぎる終了をなぜスローするのか誰にも分かりますか?coldfusion xml xsltファイルの早すぎるエラーのエラー

<cfxml variable="xslt"> 
     <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
      <!--- Start by matching the root node. ---> 
      <xsl:template match="/nodes"> 
       <nodes> 
        <!--- 
         Inside our new root node, output all the top- 
         level NODE elements (ie. those with a parentID 
         value of zero). 
        ---> 
        <xsl:call-template name="getChildNodes" /> 
       </nodes> 
      </xsl:template> 
      <!--- This function outputs all child node elemenst of the node with the given ID. ---> 
      <xsl:template name="getChildNodes"> 
       <!--- Param our parent ID. ---> 
       <xsl:param name="parentID" select="0" /> 
       <!--- Select all the child node elements that have the given parentID. ---> 
       <xsl:for-each select="//node[@parent-id=$parentID]"> 
        <!--- Sort this node list on ID. ---> 
        <xsl:sort select="@id" /> 
        <!--- Output the new node. ---> 
        <node id="{@id}" parent-id="{@parent-id}" name="{@name}"> 
         <!--- 
          Now that are outputting a given node, let's 
          output all the child nodes that might be a 
          descendant of it. 

          NOTE: This is the recursive aspect of this 
          XSTL approach. 
         ---> 
         <xsl:call-template name="getChildNodes"> 
          <xsl:with-param name="parentID" select="@id"/> 
         </xsl:call-template> 
        </node> 
       </xsl:for-each> 
      </xsl:template> 
     </xsl:transform> 
    </cfxml> 

上記セグメントは、このフル機能の一部です:

<cffunction name="xmlNav" access="private" returntype="struct" output="false"> 
    <cfargument name="qGetNav" type="query" required="true"> 
    <cfset var qNav = arguments.qGetNav> 
    <cfset var rawNodeTree=""> 
    <cfset var xslt=""> 
    <cfxml variable="rawNodeTree"> 
     <cfoutput> 
     <nodes> 
      <cfloop query="qNav"> 
       <node id="#qNav.navid#" parent-id="#qNav.navparentID#" name="#qNav.TextDesc#"/> 
      </cfloop> 
     </nodes> 
     </cfoutput> 
    </cfxml> 
    <cfxml variable="xslt"> 
     <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
      <!--- Start by matching the root node. ---> 
      <xsl:template match="/nodes"> 
       <nodes> 
        <!--- 
         Inside our new root node, output all the top- 
         level NODE elements (ie. those with a parentID 
         value of zero). 
        ---> 
        <xsl:call-template name="getChildNodes" /> 
       </nodes> 
      </xsl:template> 
      <!--- This function outputs all child node elemenst of the node with the given ID. ---> 
      <xsl:template name="getChildNodes"> 
       <!--- Param our parent ID. ---> 
       <xsl:param name="parentID" select="0" /> 
       <!--- Select all the child node elements that have the given parentID. ---> 
       <xsl:for-each select="//node[@parent-id=$parentID]"> 
        <!--- Sort this node list on ID. ---> 
        <xsl:sort select="@id" /> 
        <!--- Output the new node. ---> 
        <node id="{@id}" parent-id="{@parent-id}" name="{@name}"> 
         <!--- 
          Now that are outputting a given node, let's 
          output all the child nodes that might be a 
          descendant of it. 

          NOTE: This is the recursive aspect of this 
          XSTL approach. 
         ---> 
         <xsl:call-template name="getChildNodes"> 
          <xsl:with-param name="parentID" select="@id"/> 
         </xsl:call-template> 
        </node> 
       </xsl:for-each> 
      </xsl:template> 
     </xsl:transform> 
    </cfxml> 

    <cfset myXmlNav.xmlNav=rawNodeTree> 
    <cfset myXmlNav.IsXml=IsXML(myXmlNav.xmlNav)> 
    <cfreturn myXmlNav> 
</cffunction> 

私は様々なコメントを読んだ後、CFC

+0

これは簡単にデバッグできます。 ''の内容から行を削除し、どの点で動作するかを確認してください。 XSLT自体は上手く見えます。 – Tomalak

+0

私の返事にピークを迎え、すべてを取り除こうとしましたが、まだ行っていません。 –

+0

CFページに「」という空白が1つあります。信じがたい。 – Tomalak

答えて

0

を削除する必要がありました:

<cffunction name="xmlNav" access="private" returntype="struct" output="false"> 
    <cfargument name="qGetNav" type="query" required="true"> 
    <cfset var qNav = arguments.qGetNav> 
    <cfset var rawNodeTree=""> 
    <cfset var xslt=""> 
    <cfset var xsltfile="#Instance.AppShared.AppServerInfo.ApplicationPath#\model\layout\MenuXsl"> 
    <!--- Reference: http://www.bennadel.com/blog/2045-Ask-Ben-Converting-A-Parent-Child-Data-Table-Into-A-Nested-XML-Document.htm ---> 
    <cfxml variable="rawNodeTree"> 
     <cfoutput> 
     <nodes> 
      <cfloop query="qNav"> 
       <node id="#qNav.navid#" parent-id="#qNav.navparentID#" name="#qNav.TextDesc#"/> 
      </cfloop> 
     </nodes> 
     </cfoutput> 
    </cfxml> 
    <cffile action="Read" file="#xsltfile#" variable="xslt"> 
    <cfset xslt=XmlParse(xslt)> 

    <cfset myXmlNav.xslt=xslt> 
    <cfset myXmlNav.xmlNav=rawNodeTree> 
    <cfset myXmlNav.xmlNav=XmlParse(xmlTransform(myXmlNav.xmlNav,myXmlNav.xslt))> 
    <cfreturn myXmlNav> 
</cffunction> 

、ここで第二は、XSLTファイルです:

最初にここでは、モデルの方法でした私の解決策は、私がここに投稿したものと完全に絡み合っています。coldfusion xml menu助けてくれてありがとう@Tomalak。

1

外にそれ自身でそれを実行することができます確認している、私が実装しなければなりませんでしたベンの解を次のように解きます。それがコールドボックスか何か他のものだったかどうかわからないが、ここに行く。

<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:template match="/nodes"> 
     <nodes> 
      <xsl:call-template name="getChildNodes" /> 
     </nodes> 
    </xsl:template> 
    <xsl:template name="getChildNodes"> 
     <xsl:param name="parentID" select="0" /> 
     <xsl:for-each select="//node[@parent-id=$parentID]"> 
      <xsl:sort select="@id" /> 
      <node id="{@id}" parent-id="{@parent-id}" name="{@name}"> 
       <xsl:call-template name="getChildNodes"> 
        <xsl:with-param name="parentID" select="@id"/> 
       </xsl:call-template> 
      </node> 
     </xsl:for-each> 
    </xsl:template> 
</xsl:transform> 

私は私が変えてしまったコメントのすべてあまりにも

+0

コメントは完全に有効なColdFusionコメントです。彼らは何も壊しません。 – Tomalak

+0

私は多くを考えました、私はそれを試みると思ったが、サイコロ –

関連する問題