2013-11-27 2 views
0

에서 나는 오류가 발생 상속 XSLT 템플릿과 붙어 :XSL 변수 또는 매개 변수는 정의되어 있지만 파일

line 200: Variable or parameter 'child' is undefined. 

문제는, 어떤 변수 또는 매개 변수 "아이가"이 거기에 없습니다를 줄 또는 다른 파일 전체. "자식"에 대한 유일한 참조는 xpath에 있습니다. 여기

<xsl:with-param name="ancestor"><xsl:value-of select="$ancestor"/></xsl:with-param> 

을 내가 관련되어 있다고 생각하는 전체 부분 : 라인 (200)은 다음과 같습니다.

<xsl:template name="create_title_row"> 
    <xsl:param name="ancestor"/> 
    <xsl:param name="columnDepth"/> 
    <xsl:param name="pos"/> 
    <xsl:if test="$ancestor &lt; $columnDepth"> 
    <tr> 
     <xsl:for-each select="/mask/table[position()=$pos]/descendant::clmn[count(ancestor::clmn) = $ancestor]">    
     <xsl:call-template name="create_column">   
      <xsl:with-param name="ancestor"><xsl:value-of select="$ancestor"/></xsl:with-param> 
      <xsl:with-param name="columnDepth"><xsl:value-of select="$columnDepth"/></xsl:with-param> 
     </xsl:call-template> 
     </xsl:for-each> 
    </tr> 
    <xsl:call-template name="create_title_row"> 
     <xsl:with-param name="ancestor" select="$ancestor + 1"/> 
     <xsl:with-param name="columnDepth" select="$columnDepth"/> 
     <xsl:with-param name="pos" select="$pos"/> 

    </xsl:call-template> 
    </xsl:if> 
</xsl:template> 

<xsl:template name="create_column"> 
    <xsl:param name="ancestor"/> 
    <xsl:param name="columnDepth"/> 

    <xsl:variable name="for_export"><xsl:value-of select="/mask/@for_export"/></xsl:variable> 

    <xsl:variable name="depth"> 
    <xsl:for-each select="descendant::clmn[not(child::clmn)]"> 
     <xsl:sort select="count(ancestor::clmn)"/> 
     <xsl:if test="position()=last()"> 
     <xsl:value-of select="count(ancestor::clmn)"/> 
     </xsl:if> 
    </xsl:for-each> 
    </xsl:variable> 

    <xsl:variable name="rowspan"> 
    <xsl:if test="$depth= ''"> 
     <xsl:value-of select="$columnDepth - $ancestor"/> 
    </xsl:if> 
    <xsl:if test="$depth!= ''">1</xsl:if> 
    </xsl:variable> 

    <xsl:variable name="abstand">  
    <xsl:if test="$ancestor!=0 or position()!=1">0</xsl:if> 
    <xsl:if test="$ancestor=0 and position()=1">1</xsl:if> 
    </xsl:variable> 

    <xsl:variable name="cs"> 
    <xsl:if test="$depth= ''"> 
     <xsl:value-of select="@colspan"/>       
    </xsl:if> 
    <xsl:if test="$depth!= ''"> 
     <xsl:value-of select="sum(descendant::clmn[not(child::clmn)]/@colspan)"/>   
    </xsl:if> 
    </xsl:variable> 

    <xsl:variable name="colspan"> 
    <xsl:if test="$cs!=0"> 
     <xsl:value-of select="$cs + $abstand"/> 
    </xsl:if> 
    <xsl:if test="$cs=0"> 
     <xsl:value-of select="1 + $abstand"/> 
    </xsl:if> 
    </xsl:variable>  

    <td class="column_title"> 
    <xsl:if test="$rowspan>'1'"> 
     <xsl:attribute name="rowspan"><xsl:value-of select="$rowspan"/></xsl:attribute> 
    </xsl:if> 
    <xsl:if test="$colspan>'1'"> 
     <xsl:attribute name="colspan"><xsl:value-of select="$colspan"/></xsl:attribute> 
    </xsl:if> 


    <xsl:if test="$for_export='0'"> 
     <xsl:if test="string-length(@link)=0"> 
     <xsl:value-of select="@title"/> 
     <xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>   
     </xsl:if> 

     <xsl:if test="string-length(@link)!=0"> 
     <xsl:if test="string-length(@desc)!=0"> 
      <xsl:value-of select="@title"/> 
      <xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>   

      <a class="mask_top" href="javascript:;" onclick="return(getOnlineHelp('{@link}'));" onmouseover="return(setzeStatus('{@desc}'));" onmouseout="return(setzeStatus(''));"> 
      <xsl:value-of select="@desc"/> 
      </a> 
     </xsl:if> 

     <xsl:if test="string-length(@desc)=0"> 
      <a class="mask_top" href="javascript:;" onclick="return(getOnlineHelp('{@link}'));" onmouseover="return(setzeStatus('{@title}'));" onmouseout="return(setzeStatus(''));"> 
      <xsl:value-of select="@title"/> 
      </a> 
     </xsl:if> 
     </xsl:if> 
    </xsl:if>   

    <xsl:if test="$for_export='1'"> 
     <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>   
     <xsl:value-of select="@title"/> 
    </xsl:if>   
    <xsl:if test="string-length(@comment)!=0"> 
     <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>   
     <sup><xsl:value-of select="@comment"/></sup> 
    </xsl:if> 
    </td> 
</xsl:template> 
+0

첫 번째 생각은 해당 파일의 200 행을 참조하지 않았을 수 있습니다. 다른 xsl 파일을 참조 할 수있는 xsl : import/xsl : include 지침이 있습니까? – Flynn1179

+0

줄 200은 보여준 템플릿 밖에 있습니다. 맞습니까? 그래서, 그 안의 템플릿이 아닌 레벨에는'ancestor'라는 변수의 정의가 있어야합니다. 공유 할 수 있습니까? –

+0

사용중인 XSLT 프로세서를 말하는 것이 유용합니다. 여기서 모호한 오류 메시지에 익숙한 사람을 찾을 수 있습니다. 다른 프로세서를 통해 스타일 시트를 실행하여 더 나은 진단 결과를 얻을 수 있는지 확인할 수도 있습니다. –

답변

1

지금 (2018) 동일한 오류가 발생했습니다. 수입이없고 선은 매우 유사합니다. 오류가있는 줄은 다음과 같습니다.

<xsl:with-param name="ancestor" select="$ancestor"/> 

변수의 이름을 firstFather로 변경하면 오류가 사라집니다.

<xsl:with-param name="firstFather" select="$firstFather"/> 

저는 조상이 예약 된 이름이고 변수로 사용될 때 실패한다고 생각합니다.

+0

이것은 실제로 질문에 대답하지 않습니다. 다른 질문이있는 경우 [질문하기] (https://stackoverflow.com/questions/ask)를 클릭하여 질문 할 수 있습니다. [평판] (https://stackoverflow.com/help/privileges/set-bounties)을 충분히 확보하면 [현상금 추가] (https://stackoverflow.com/help/privileges/set-bounties)를 통해이 질문에 더 집중할 수 있습니다. 평판). - [리뷰에서] (리뷰/저품절 게시물/18888851) – JimHawkins

관련 문제