[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Finding the path from the filename
Subject: RE: [xsl] Finding the path from the filename From: "bryan" <bry@xxxxxxxxxx> Date: Mon, 20 Jan 2003 16:49:18 +0100 |
You can also use substring-after. I'm pretty sure this is a faq, anyway it's one of those things that I've got the bad habit of writing anew as I need it rather than just going to get it from some place I've got it and copying, so there's always some sort of error likely to crop in without testing, you may have to rearrange some parts after testing on your own. <xsl:param name="filepathANDname"/> <xsl:variable name="filename"> <xsl:call-template name="filenamegetter"><xsl:with-param name="thisPathANDname" select="$filepathANDname"/> </xsl:call-template> </xsl:variable> <xsl:variable name="filepath"><xsl:value-of select="substring-before($filepathANDname,$filename)"/></xsl:variable> <xsl:template name="filenamegetter"> <xsl:param name="thisPathANDname"/> <xsl:variable name="afterthisPathANDname" select="substring-after($thisPathANDname,'\')"/> <xsl:choose><xsl:when test="contains($thisPathANDname,'\')"> <xsl:call-template name="filenamegetter"><xsl:with-param name="thisPathANDname" select="$afterthisPathANDname"/></xsl:call-template> </xsl:when><xsl:otherwise><xsl:value-of select="$thisPathANDname "/></xsl:otherwise></xsl:choose> </xsl:template> note that Cams example with lastCharPosition could be used to make this process much more generic. Note that I would not say this is a 100% secure method but close enough not to be easily discernable from the 100% secure. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Finding the path from the, Oleg Tkachenko | Thread | RE: [xsl] Finding the path from the, Américo Albuquerque |
Re: [xsl] Finding the path from the, Oleg Tkachenko | Date | RE: [xsl] Finding the path from the, Américo Albuquerque |
Month |