1
<!-- Get the url of a node based on a list of positions (starting point = language root) -->
<xsl:template name="getUrl">
  <xsl:param name="id" />
  <xsl:param name="positions" />
  <xsl:param name="i" select="0" />
  <xsl:param name="max" />

  <!-- Return the url -->
  <xsl:if test="$i = $max">    
    <xsl:value-of select="umbraco.library:NiceUrl($id)" />    
  </xsl:if>

  <xsl:if test="$i &lt; $max">
    <xsl:call-template name="getUrl">
      <xsl:with-param name="id">
        <!-- Define the id of the next item in the tree structure -->
        <xsl:for-each select="//* [@id = $id]/child::* [@isDoc]">
          <xsl:if test="position() = number(umbraco.library:Split($positions, ',')/value[number($i)])">  
            <xsl:value-of select="@id" />
          </xsl:if>
        </xsl:for-each>
      </xsl:with-param>
      <xsl:with-param name="positions">
        <xsl:value-of select="$positions"/>
      </xsl:with-param>
      <xsl:with-param name="i">
        <xsl:value-of select="$i + 1"/>
      </xsl:with-param>
      <xsl:with-param name="max">
        <xsl:value-of select="$max"/>
      </xsl:with-param>    
    </xsl:call-template>
  </xsl:if>  
</xsl:template>

XLST ファイルでマクロを使用しています。このコードを使用すると、エラーが発生します (値が Int32 に対して大きすぎるか小さすぎます)。エラーは次の 2 行で発生します。

<xsl:value-of select="umbraco.library:NiceUrl($id)" /> 
<xsl:call-template name="getUrl">

このXSLTファイルは、私が作成した新しいページを除いて、すべてのページで正常に機能するため、誰かが私がここで間違っていることを教えてもらえますか.

4

1 に答える 1