|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: extracting file name from unparsed-entity-uri
I have need to extract the "file name" from a string returned by
unparsed-entity-uri. Obviously, the path is dependent on where the file sits
so it can be of arbitrary length. The string I am dealing with is something
like file:/C:/foo/bar/somefile.gif where I need the somefile.gif string. Is
there a way to do this in XSL or with an extension? Any help would be
greatly appreciated.
<xsl:call-template name="filename">
<xsl:with-param name="x" select="$path"/>
</xsl:call-template>
$path is the expression with your path, and filename template looks
something like this:
<xsl:template name="filename">
<xsl:param name="x"/>
<xsl:choose>
<xsl:when test="contains($x,'/')">
<xsl:call-template name="filename">
<xsl:with-param name="x" select="substring-after($x,'/')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$x"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








