W3C home > Mailing lists > Public > xsl-editors@w3.org > April to June 1999

Re: Simple suggestion for XSLT

From: James Clark <jjc@jclark.com>
Date: Mon, 10 May 1999 04:05:58 +0700
Message-ID: <3735F8B5.BDF6DC11@jclark.com>
To: "Laurent M." <laurent_m@hotmail.com>
CC: xsl-editors@w3.org, xsl-list@mulberrytech.com
"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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:49 GMT