Re: Simple suggestion for XSLT

"Laurent M." wrote:

> I was really trying to get to this:
> 
> "C:\some\thing\some\thing\some\thing\IdontKnowAnymoreTheDepthOfThePath\This
> IsThePart.IAmLookingFor

You can do it with:

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

James

Received on Sunday, 9 May 1999 17:11:33 UTC