2016-04-27 13 views
-1

私はループ内で宣言された変数を使用しようとしています。しかし、そのは私にエラー を与え、私のXSLTは私のXMLが今何をそのスコープ外のグローバル変数を使用しています

<chapter id="4.2.1" heading=" Feasibility">   

     <tbl> 
      <columns> 
       <c name="Controller"/> 
       <c name="Prechecks " align="center"/> 
       <c name="Prechecks Review" align="center"/> 
      </columns> 
     </tbl> 
    </chapter> 

が何であるかをtotal_error and err_cnttotal_warning and warn_cnt

を追加することにより、

   <xsl:for-each select="document($kush_xml)"> 


         <xsl:variable name="total_error" select="sum(vfiler/@error)"/> 
         <xsl:variable name="total_warning" select="sum(vfiler/@warning)"/> 
        <xsl:variable name="err_cnt"> 
          <xsl:value-of select="count(document($precheck_cft_xml)/ 
          kush/sevenmtt_cft/jobs/precheck_job/result_entries/ 
          resultEntry[result/aptType='BLOCKING_ERROR' and 
          not(contains($filter_cft_codes,result/code)) and 
          result/aptType!='NEW_STEP' and 
          (result/affectedCommonResources/controllerName=$controller or 
          (not(result/affectedCommonResources/controllerName) and 
          (ancestor::precheck_job/@controller_a=$hostname or ancestor::precheck_job/@controller_b=$hostname)))])"/> 

        </xsl:variable> 

        <xsl:variable name="warn_cnt"> 
         <xsl:value-of select="count(document($precheck_cft_xml)/ 
         netapp/sevenmtt_cft/precheck_jobs/precheck_job/result_entries/ 
         resultEntry[result/aptType='SERIOUS_WARNING' and 
         not(contains($filter_cft_codes,result/code)) and 
         result/aptType!='NEW_STEP' and 
         (result/affectedCommonResources/controllerName=$controller or 
         (not(result/affectedCommonResources/controllerName) and 
         (ancestor::precheck_job/@controller_a=$hostname or ancestor::precheck_job/@controller_b=$hostname)))])"/> 
        </xsl:variable> 

私はテーブルエントリを計算する必要があります私はしたいですwarn_cnterr_cntを使用してループ外の<for-each>を使用します。私はこれらの値に基づいてテーブル内の値を計算する必要があります。何とか私は複数のテーブルを作成するので、タグでテーブルを作ることができません。だから私はテーブルコードをループの外に書く必要があります。 私は何をしようと変数<for:each>ループを使用していますが、その役立たない。 は親切に私が試したものを

<xsl:variable name="warn_cnt"> 
          <xsl:for-each select="document($precheck_xml)/kush/sevenmtt/controller"> 
           <xsl:value-of select="count(document($precheck_cft_xml)/ 
           netapp/sevenmtt_cft/precheck_jobs/precheck_job/result_entries/ 
           resultEntry[result/aptType='SERIOUS_WARNING' and 
           not(contains($filter_cft_codes,result/code)) and 
           result/aptType!='NEW_STEP' and 
           (result/affectedCommonResources/controllerName=$controller or 
           (not(result/affectedCommonResources/controllerName) and 
           (ancestor::precheck_job/@controller_a=$hostname or ancestor::precheck_job/@controller_b=$hostname)))])"/> 
          </xsl:for-each> 
         </xsl:variable> 

<xsl:variable name="err_cnt"> 
          <xsl:for-each select="document($precheck_xml)/netapp/sevenmtt/controller"> 
           <xsl:value-of select="count(document($precheck_cft_xml)/ 
           kush/sevenmtt_cft/precheck_jobs/precheck_job/result_entries/ 
           resultEntry[result/aptType='BLOCKING_ERROR' and 
           not(contains($filter_cft_codes,result/code)) and 
           result/aptType!='NEW_STEP' and 
           (result/affectedCommonResources/controllerName=$controller or 
           (not(result/affectedCommonResources/controllerName) and 
           (ancestor::precheck_job/@controller_a=$hostname or ancestor::precheck_job/@controller_b=$hostname)))])"/> 
          </xsl:for-each> 
         </xsl:variable> 

であるが、これはワークアウトされていない私を助けて。

+0

同じ質問を2回転記しないでください。代わりに、必要なものを明確にするために時間と労力を費やしてください。 –

答えて

0

入力がなくても、目標が何であるかは今少し難しいです。

ここで私が望むのは、warn_cntとerr_cntをループ外で使用することです。

しかし、私はループの必要はないと仮定します。

<xsl:variable name="kush_doc" select="document($kush_xml)" /> 
<xsl:variable name="total_error" select="sum($kush_doc/vfiler/@error)"/> 
<xsl:variable name="total_warning" select="sum($kush_doc/vfiler/@warning)"/> 
関連する問題