2017-12-15 16 views
1

XMLでエラーチェックを行うためにXSLTを作成していますが、タグ/要素をパラメータとしてサブルーチンに渡していますが、パラメータの表示に問題がありますエラーメッセージ。XSLサブルーチンのパラメータが表示されない

なぜ私は$ param1が表示されないのか(なぜそれが空であるのか)理解できません。次のように

コードは次のとおりです。

私は答えが

<!-- ABOUT_VERSION level --> 
<xsl:template match="m:ABOUT_VERSION"> 
    <xsl:call-template name="TagCheckCount"> 
     <xsl:with-param name="param1" select="m:CreatedDatetime"/> 
     <xsl:with-param name="param2" select="1"/> 
     <xsl:with-param name="param3" select="1"/> 
    </xsl:call-template> 
</xsl:template> 

<!-- Check The Numbers of Tags that exist --> 
<xsl:template name="TagCheckCount"> 
    <xsl:param name="param1"/> <!-- Tag --> 
    <xsl:param name="param2"/> <!-- Lower Bound --> 
    <xsl:param name="param3"/> <!-- Upper Bound --> 

    <xsl:choose> 
     <!-- If Lower and Upper Bounds are 1 --> 
     <xsl:when test="$param2 = 1 and $param3 = 1"> 
      <!-- Check if it exists --> 
      <xsl:call-template name="TagCheckExists"> 
       <xsl:with-param name="param1" select="$param1"/> 
      </xsl:call-template> 
     </xsl:when> 
     <!-- Else If --> 
     <xsl:otherwise> 
      <!-- Count is < Lower Bound --> 
      <xsl:call-template name="TagCheckLT"> 
       <xsl:with-param name="param1" select="$param1"/> 
       <xsl:with-param name="param2" select="$param2"/> 
      </xsl:call-template> 
      <!-- Count is > Upper Bound --> 
      <xsl:call-template name="TagCheckGT"> 
       <xsl:with-param name="param1" select="$param1"/> 
       <xsl:with-param name="param2" select="$param2"/> 
      </xsl:call-template> 
     </xsl:otherwise> 
    </xsl:choose> 
</xsl:template> 


<!-- Check if Tag exists --> 
<xsl:template name="TagCheckExists"> 
    <xsl:param name="param1"/> <!-- Tag --> 

    <xsl:value-of select="string($param1)" /><br/><br/><br/> 

    <!-- Check if it exists --> 
    <xsl:if test="not($param1)"> 
     <!-- Return Error Message and XPath --> 
     <p class="error">Requirement: Missing: <xsl:call-template name="GetFullPath"/><xsl:value-of select="string($param1)" /></p> 
    </xsl:if> 
</xsl:template> 
+0

Consi derはXMLとXSLTの最小限の完全なサンプルを投稿し、問題を再現できるようにしました。何をチェックしたいのですか?どの結果が必要ですか?どちらの結果が得られますか? –

+0

TagCheckExistsのparam1でしたが、パラメータが最上部に設定されていると、想定された文字列が適切に引用されていないことに気付きました。 – Kamurai

答えて

0

を選択= "文字列($ PARAM1)" にしようとしただけ= "$のPARAM1" を選択します。

渡すときSTRINGの場合は、二重引用符で囲んだ文字列を一重引用符で囲む必要があります。

関連する問題