我需要从Xsl:value以Xsl形式生成的XML代码中获取文件名

我需要从Xsl:value以Xsl形式生成的XML代码中获取文件名,xml,xslt,Xml,Xslt,从中会出现包含数据的XML代码,我需要从该值中提取文件名,{For eg:value可以是}我最后需要的值是File name=spend plan.123。在XSL表单中有任何条件可以这样检查吗 <xsl:choose> <xsl:when test="string-length($CashFlowAttach)!=0"> <xsl:if test="not(contains($CashFlowAttach,'&lt;p xmlns:Utils=&a

中会出现包含数据的XML代码,我需要从该值中提取文件名,{For eg:value可以是

}我最后需要的值是File name=spend plan.123。在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>

ajaxcallingForFileDownload(“”)

我建议将此模板添加到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>


您需要“资源/附件/”部分,还是只需要文件名“支出计划.123”?我只需要文件名。我上面提到的值,例如它来自数据库。