0

そこから<xsl:value-of select="$CashFlowAttach" />XML コードにデータが含まれるようになります。その値からファイル名を抽出する必要があります<p xmlns:Utils="cim:Utils"><a href="resources/Attachment/spend plan.123"><image border="0" width="89px" height="47px" src="resources/Content/images/CIMtrek_spend_plan_123.gif"></image></a></p>。XSLフォームでそのようにチェックする条件はありますか

<xsl:choose>
 <xsl:when test="string-length($CashFlowAttach)!=0">
  <xsl:if test="not(contains($CashFlowAttach,'&lt;p xmlns:Utils=&quot;cim:Utils&quot;&gt;'))">
   <a>
    <xsl:attribute name="onclick">ajaxcallingForFileDownload('<xsl:value-of        select="$CashFlowAttach" />')  
    </xsl:attribute>
     <xsl:value-of select="$CashFlowAttach" />
   </a>
  </xsl:if>
 </xsl:when>
</xsl:choose>
4

1 に答える 1

2

このテンプレートを XSLT に追加することをお勧めします。

  <xsl:template name="GetFileName">
    <xsl:param name="path" />
    <xsl:choose>
      <xsl:when test="contains($path, '/')">
        <xsl:call-template name="GetFileName">
          <xsl:with-param name="path"
                          select="substring-after($path, '/')" />
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$path"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

このテンプレートを使用して、パスの末尾にあるファイル名を取得できます。次に、次のようなものを使用して呼び出します。

<xsl:variable name="fileName">
  <xsl:call-template name="GetFileName">
     <xsl:with-param name="path"
      select="substring-before(substring-after($CashFlowAttach, 'a href=&quot;'), 
                                  '&quot;')" />
  </xsl:call-template>
</xsl:variable>
于 2013-02-04T10:09:22.447 に答える