0

フォーラムで GetMedia のエラーを検索したところ、関数に与える変数 i が整数ではないことがわかりました。

エラーは次のとおりです: System.OverflowException: 値が Int32 に対して大きすぎるか小さすぎます。

私は自分の変数をチェックします:

<xsl:value-of select="$currentPage/image" />

出力は次のとおりです。

1663

それから私はこれを試します:

<xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/image, false())" />

上で書いたエラーが返されます。$currentPage/image の代わりに 1663 を書いた場合は動作しますが、ハードコードされており、ハードコードされてはなりません。

ここに私のxslt

<xsl:template match="/">

<!-- start writing XSLT -->
<xsl:value-of select="$currentPage/image" />
<xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/image, false())" />
<div class="tfirst">
<p>
    <!--xsl:if test="not($media/error)">
        <img src="{$media/umbracoFile}" class="left timg" />
    </xsl:if-->
    <div class="ttext">
        <h2><xsl:value-of select="umbraco.library:StripHtml($currentPage/title)" /></h2>
        <xsl:value-of select="$currentPage/abstractText" disable-output-escaping="yes" />
    </div>
</p>
</div>
<div class="ttext">
<xsl:if test="$currentPage/showMultipleColumns='1'">
    <xsl:attribute name="class">showMultipleColumns</xsl:attribute>
</xsl:if>
<xsl:value-of select="$currentPage/bodyText" disable-output-escaping="yes" />
</div>

</xsl:template>

ご協力ありがとうございました。ベンジャミン

編集 - - - - - - - - -

if テストを追加しようとしましたが、 $currentPage/image を 1663 に置き換えると別のエラーが発生するようになりました: System.Xml.Xsl.XslTransformException: To use a result tree fragment in a path expression, first convert it to a msxsl:node-set() 関数を使用したノード セット。

$currentPage/image を許可すると、常に次のようになります: System.OverflowException: 値が Int32 に対して大きすぎるか小さすぎます。

xslt は次のとおりです。

<xsl:variable name="atest" select="umbraco.library:GetMedia($currentPage/image, false())" />
<xsl:variable name="media">
    <xsl:if test="$currentPage/image &gt; 0">
        <xsl:value-of select="$atest" />
    </xsl:if>
</xsl:variable>

編集2------------

以下でこれを試みると、常にエラーが発生します: System.OverflowException: 値が Int32 に対して大きすぎるか小さすぎます。

<xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/image, false())" />
<xsl:if test="$media">
  <img src="{$media/umbracoFile}" class="left timg" />
</xsl:if>
4

2 に答える 2